Here is a dead simple patch to import translation files for all enabled modules when adding a new language. To do this cleanly, I have done the following:
- renamed the _installer and _system batch functions to _by_language() and _by_component(), moved the finished callback to an optional parameter to facilitate reuse
- modified language addition, so a new language is made enabled automatically (this is logical in itself and is also more logical with the importing taking place - we only import for enabled stuff)
- added a little finished callback to inform the user about the results of language file imports when a new language is added.
Tested with the Czech language files posted by meba before (http://drupal.org/node/142869). Done the following to test:
- clean database install with Czech locale: install time importing still works
- deleted the Czech language on the admin interface
- added the Czech language on the admin interface: translations were imported for all enabled modules
- went to the module list and installed some modules: translation importing worked for the newly installed modules
This is a simple and straightforward patch to complete the language importing circle. Drupal and module update related functionality and the reimport functionality desired by Dries will come in a joint patch once this is in.
Comment | File | Size | Author |
---|---|---|---|
language_import_1.patch | 5.62 KB | Gábor Hojtsy | |
Comments
Comment #1
meba CreditAttribution: meba commentedNothing to say. Just works :-) No issues with patching or notices
Comment #2
Dries CreditAttribution: Dries commentedClean and simple -- can go straight in.
Comment #3
Dries CreditAttribution: Dries commentedCommitted!
Comment #4
(not verified) CreditAttribution: commented