ReinProject / python-rein

Client for a decentralized freelancing market
https://reinproject.org
GNU General Public License v3.0
37 stars 21 forks source link

Localization and restructured tests #102

Closed chbeltz closed 7 years ago

weex commented 7 years ago

Did a bit of testing and found a few things:

chbeltz commented 7 years ago

Oh, right!

I didn't even notice it looking for the wrong name because it still worked. Is the Linux file system case-sensitive?

weex commented 7 years ago

Yes and the manifest part only gets tested/used if you're not installing with the --editable flag. Thanks.

weex commented 7 years ago

I noticed in testing that no matter the case of the language part of the messages_. files, the language part comes out in caps when installed. Looking at locale info on Ubuntu, I saw Spanish represented as es_ES. So made the following change and it "just worked" after that. Can you try that same change on Windows? If that works, then that would be the final update to this before it can be merged.

diff --git a/rein/lib/localization.py b/rein/lib/localization.py
index c5833af..c216edb 100644
--- a/rein/lib/localization.py
+++ b/rein/lib/localization.py
@@ -8,7 +8,7 @@ def init_localization():
   '''prepare l10n'''
   # Extract system locale identifier
   loc = locale.getdefaultlocale()[0]
-  file_name = "messages-%s.mo" % loc.split('_')[0]
+  file_name = "messages-%s.mo" % loc.split('_')[1]
chbeltz commented 7 years ago

So you're saying the second part of the file name is still upper-case despite pulling in the most recent changes?

If so, try the following

git config core.ignorecase false

before pulling again. Theoretically, people who pull it now should get the lower-case file names so we should try that before going with your solution.

weex commented 7 years ago

Tried that but have same issue. Git seems to be checking it out right with the lower case. It's just that python setup.py install is upper casing the last two letters as it installs it to system. The in-place pip install is unlikely to have the same issue.

Next question is probably if setuptools has some locale-awareness causing it to do that.

chbeltz commented 7 years ago

Out of pure curiosity, did you try deleting your build folder before re-installing after pulling in the lower-case files? It installed lower-case filenames even after I'd upper-cased them because I hadn't cleared the previous build.

This one should work though. I simply upper-cased the locale that's fetched by the script aswell as the file names. I decided to not take your approach of grabbing the second part of the locale as I believe that part sometimes represents a country as opposed to a language (eg: en_GB).

Do try it out and let me know though!