Open pvdv opened 13 years ago
This is a bug with the setup, not the software.
Another point here is, that there needs to come a script what updates the translation on all chatsites, for the case there is something changed in git/egg.
Part of this is setup, but part of it is also making at possible for site-administrators to create their local translations. The default translations should be in Github, but local translations should be editable with Django-Rosetta.
the place in which django looks for locale files can be controlled via LOCALE_PATHS
and paths in that tuple take precedence over /helpim/locale/
. so this can easily configured to be a directory writeable by the webserver.
django-rosetta is installed and running at the url /admin/translate/.
as for the "newspeak"-locale-catalogue, this should start as a copy of the dutch translation with its own language-code, say "zz". the customer can make changes to it via the rosetta-interface.
when the helpim-instance needs updating, the /locale/zz/ directory needs to be backed up. After the helpim-instance has been updated, the backed up /locale/zz/ with the customer's changes needs to be put back into place. Then, running makemessages -l zz
will update just the newspeak-catalogue and will try to handle possibly conflicting changes. When in doubt, it will mark translations as "fuzzy" which can be filtered for in rosetta. Obsolete translations get commented out.
On 10/15/2012 04:54 PM, Steffen Platte wrote:
Looks very good, nice job. Let me write it down in my own words, then you can check if I got it correctly. I Will add some questions inline ('Q:').
Assume the customer "Oceania" want a local called 'newspeak'. We assign it language code 'en-ns'.
1) create the directory: /var/local/helpim/oceania/locales/en-ns and make it writable by the user 'oceania' Q: is the path correct? Q: is the permissions part correct?
2) in the site configuration of Oceania, set the "LOCALE_PATHS": LOCALE_PATHS=['/var/local/helpim/oceania/locales']
3) in de site configuration of Oceania, set the 'LANGUAGE_CODE' and the 'language' of the bot: LANGUAGE_CODE = 'en-ns' BOT['language'] = 'en-ns'
4) tell the customer to update newspeak on /admin/translate/ Q: after updating, is there a admin-command that need to be run or is there the need for a reload/restart?
5) When updating HelpIM, run django-admin makemessages -l en_ns Q: is it correct there is no need to copy the messages back and forth because the LC_MESSAGES are in a different directory? Or should we do first: cp -r /var/local/helpim/oceania/locales/ \ /var/local/helpim/oceania/locales.bak/ cp /usr/local/share/helpim/locale/en/LC_MESSAGES/* \ /var/local/helpim/oceania/locales/en_ns/LC_MESSAGES/ cp /var/local/helpim/oceania/locales.bak/en_ns/LCMESSAGES/* \ /var/local/helpim/oceania/locales/en_ns/LC_MESSAGES/
Winfried
1) create the directory: /var/local/helpim/oceania/locales/en-ns and make it writable by the user 'oceania' Q: is the path correct? Q: is the permissions part correct?
Generally, the location can be chosen freely, so /var is fine. However, by convention it should be /locale/
and needs to be /en_NS/
.
The path needs to be writeable by the webserver-process. If in production the wsgi-process is run by OS user 'oceania', then yes. django-rosetta will show a warning, if it cannot write the catalogue-files.
2) in the site configuration of Oceania, set the "LOCALE_PATHS": LOCALE_PATHS=['/var/local/helpim/oceania/locales']
Yes, you point it to the '/locale/' directory, which then has {en, de, nl}/LC_MESSAGES/ underneath it. https://github.com/e-hulp/HelpIM/commit/dd09bea573382250a5e070e7bad534e1cac7998f
3) in de site configuration of Oceania, set the 'LANGUAGE_CODE' and the 'language' of the bot: LANGUAGE_CODE = 'en-ns' BOT['language'] = 'en-ns'
Since 'en-ns' is a non-standard locale code, you have to tell django about it in the LANGUAGE setting. I have prepared such a setup in the rosetta
-branch: https://github.com/e-hulp/HelpIM/commit/263ebed04c1d775d7b016b40fd0d61c481277943
4) tell the customer to update newspeak on /admin/translate/ Q: after updating, is there a admin-command that need to be run or is there the need for a reload/restart?
django-rosetta will recompile the catalogue-files automatically. However, the wsgi processes need to be restarted to pic up the changes.
5) When updating HelpIM, run django-admin makemessages -l en_ns Q: is it correct there is no need to copy the messages back and forth because the LC_MESSAGES are in a different directory?
Unfortunately, makemessages doesnt pick up the "external" messages, so you do have to copy back and forth like you outlined. makemessages has to be run inside the project-tree (/helpim/) and only works on the locale dir found there (/helpim/locale/).
The directory "locale" needs to be writeable for a chat and unshared, rosetta should be used for 'local translations'