#17181 closed New feature (fixed)
Allow for specifying multiple locales and domains for makemessages and compilemessages commands
Reported by: | Amin Mirzaee | Owned by: | Craig Blaszczyk |
---|---|---|---|
Component: | Internationalization | Version: | 1.3 |
Severity: | Normal | Keywords: | i18n makemessages compilemessages |
Cc: | aminland@…, Craig Blaszczyk | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
It is pretty annoying to have to run the commands separately for each language/domain combo without having to do all of them. Lets say only german, spanish, french, and italian have been changed. Your current choices are to run makemessages 8 times (4 each for django and djangojs domains), or to run it for all languages (which in the case of a large project like django itself, will take much much longer).
This patch allows you to specify multiple languages and/or domains when doing translation.
The old way:
django-admin.py makemessages -d django -l de django-admin.py makemessages -d django -l fr django-admin.py makemessages -d django -l es django-admin.py makemessages -d django -l it django-admin.py makemessages -d djangojs -l de django-admin.py makemessages -d djangojs -l fr django-admin.py makemessages -d djangojs -l es django-admin.py makemessages -d djangojs -l it django-admin.py compilemessages -l de django-admin.py compilemessages -l fr django-admin.py compilemessages -l es django-admin.py compilemessages -l it
With this patch:
django-admin.py makemessages -d django -d djangojs -l de -l fr -l es -l it django-admin.py compilemessages -l de -l fr -l es -l it
Backwards compatibility is maintained, and the existing defaults remain.
Attachments (1)
Change History (12)
by , 13 years ago
Attachment: | multiple_locales_and_domains.diff added |
---|
comment:1 by , 13 years ago
Cc: | added |
---|
comment:2 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → New feature |
comment:3 by , 13 years ago
Needs documentation: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
For the sake of consistency with the --extensions
option, let's make it work for both syntaxes above. It'd just be a matter of adding a few split(',')
's to the existing patch. Some documentation and tests would also be needed. Thanks!
comment:4 by , 12 years ago
Owner: | changed from | to
---|
comment:5 by , 12 years ago
Needs documentation: | unset |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
I've created a pull request for this https://github.com/django/django/pull/121
comment:6 by , 12 years ago
Triage Stage: | Accepted → Fixed on a branch |
---|
comment:7 by , 12 years ago
Cc: | added |
---|
comment:9 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Triage Stage: | Fixed on a branch → Accepted |
Initial plan was to split the work for the features proposed in the PR in two parts:
- Add support for multiple locales to makemessages and compilemessages (already done)
- Add support for multiple gettext domains to makemessages
Regarding feature b:
I found the proposed patch/PR is buggy regarding handling of multiple domains and the file extensions to be processed as pertaining to each one of these domains. Found this while adding tests for the functionality that were missing from the PR.
IMO the new functionality isn't worth the trouble both in terms of support code (relatively simple) and in terms of the command line switches UI needed to allow the user to express arbitrary combinations of domains plus their sets of file extensions.
Conclusion: I'm closing this ticket as fixed having only implemented feature a.
comment:10 by , 12 years ago
Also, I see I've not given credit in the commit message to contributor aminland who is the original author of the code. Thank you for your great work and please excuse my error.
That sounds good to me. I'm just wondering if we should allow "-d django -d djangojs -l de -l fr" or "-d django,djangojs -l de,fr" or both. Note that the "extensions" option of
makemessages
allows both.