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.

CommentFileSizeAuthor
language_import_1.patch5.62 KBGábor Hojtsy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

meba’s picture

Nothing to say. Just works :-) No issues with patching or notices

Dries’s picture

Clean and simple -- can go straight in.

Dries’s picture

Status: Needs review » Fixed

Committed!

Anonymous’s picture

Status: Fixed » Closed (fixed)