Since the PROJECT_PATH app setting was not documented, and was only ever used to determine the location of the locale files, I have renamed this to LOCALE_PATH and removed one level of path concatenation in the API methods.
I removed the lazy function and used the Django LOCALE_PATHS settings to determine the value for LOCALE_PATH, defaulting back to the './locale' should the setting not be available (which in real world use will only be when testing outside of Django). I evaluate this setting directly on importing the app_settings module, as I don't see the performance issue that might have led to using the lazy function in the first place.
Finally, since it's possible that a Django project has multiple locale paths (hence LOCALE_PATHS being a tuple), and this new setting only taking the first entry, I added a command-line flag to the tx command to allow specifying the locale path root on the command line, e.g.
./manage.py tx upload_translations it --localepath /usr/local/my/shared/locale
This works for all API calls that touch the locale files.
Tests added. A bit of minor PEP8 cleanup in there too.
Since the
PROJECT_PATH
app setting was not documented, and was only ever used to determine the location of the locale files, I have renamed this to LOCALE_PATH and removed one level of path concatenation in the API methods.I removed the lazy function and used the Django LOCALE_PATHS settings to determine the value for LOCALE_PATH, defaulting back to the './locale' should the setting not be available (which in real world use will only be when testing outside of Django). I evaluate this setting directly on importing the
app_settings
module, as I don't see the performance issue that might have led to using thelazy
function in the first place.Finally, since it's possible that a Django project has multiple locale paths (hence LOCALE_PATHS being a tuple), and this new setting only taking the first entry, I added a command-line flag to the
tx
command to allow specifying the locale path root on the command line, e.g.This works for all API calls that touch the locale files.
Tests added. A bit of minor PEP8 cleanup in there too.