Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#17181 closed New feature (fixed)

Allow for specifying multiple locales and domains for makemessages and compilemessages commands

Reported by: aminland Owned by: jakul
Component: Internationalization Version: 1.3
Severity: Normal Keywords: i18n makemessages compilemessages
Cc: aminland@…, jakul 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 aminland 5 years ago.

Download all attachments as: .zip

Change History (12)

Changed 5 years ago by aminland

comment:1 Changed 5 years ago by aminland

  • Cc aminland@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by julien

  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to New 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 5 years ago by julien

  • 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 4 years ago by jakul

  • Owner changed from nobody to jakul

comment:5 Changed 4 years ago by jakul

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I've created a pull request for this

comment:6 Changed 4 years ago by jakul

  • Triage Stage changed from Accepted to Fixed on a branch

comment:7 Changed 4 years ago by jakul

  • Cc jakul added

comment:8 Changed 4 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 4 years ago by ramiro

  • Resolution set to fixed
  • Status changed from new to closed
  • Triage Stage changed from Fixed on a branch to Accepted

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

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

Version 0, edited 4 years ago by ramiro (next)

comment:10 Changed 4 years ago by ramiro

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 4 years ago by jakul

Thanks Ramiro!

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