Opened 7 years ago

Closed 6 years ago

Last modified 6 years ago

#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


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: makemessages -d django -l de makemessages -d django -l fr makemessages -d django -l es makemessages -d django -l it makemessages -d djangojs -l de makemessages -d djangojs -l fr makemessages -d djangojs -l es makemessages -d djangojs -l it compilemessages -l de compilemessages -l fr compilemessages -l es compilemessages -l it

With this patch: makemessages -d django -d djangojs -l de -l fr -l es -l it compilemessages -l de -l fr -l es -l it

Backwards compatibility is maintained, and the existing defaults remain.

Attachments (1)

multiple_locales_and_domains.diff (20.1 KB) - added by Amin Mirzaee 7 years ago.

Download all attachments as: .zip

Change History (12)

Changed 7 years ago by Amin Mirzaee

comment:1 Changed 7 years ago by Amin Mirzaee

Cc: aminland@… added

comment:2 Changed 7 years ago by Julien Phalip

Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature

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.

comment:3 Changed 7 years ago by Julien Phalip

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 Changed 7 years ago by Craig Blaszczyk

Owner: changed from nobody to Craig Blaszczyk

comment:5 Changed 7 years ago by Craig Blaszczyk

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

I've created a pull request for this

comment:6 Changed 7 years ago by Craig Blaszczyk

Triage Stage: AcceptedFixed on a branch

comment:7 Changed 7 years ago by Craig Blaszczyk

Cc: Craig Blaszczyk added

comment:8 Changed 6 years ago by Ramiro Morales <cramm0@…>

In 6158c79dbef832bc8530107ab2d34f04a04471da:

Made (make|compile)messages commands accept multiple locales at once.

Thanks Craig Blaszczyk for the initial patch. Refs #17181.

comment:9 Changed 6 years ago by Ramiro Morales

Resolution: fixed
Status: newclosed
Triage Stage: Fixed on a branchAccepted

Initial plan was to split the work for the features proposed in the PR in two parts:

a) Add support for multiple locales to makemessages and compilemessages (already done)
b) 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.

Last edited 6 years ago by Ramiro Morales (previous) (diff)

comment:10 Changed 6 years ago by Ramiro Morales

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.

comment:11 Changed 6 years ago by Craig Blaszczyk

Thanks Ramiro!

Note: See TracTickets for help on using tickets.
Back to Top