Currently, when installing new modules we first run the install script, then we do the locale import (see system_modules_submit())
But some modules need to create strings in the database when installing, like a content type or an input filter. So we'd need:
- To load the translations before running the module's hook_install()
- To do the installation using default language, so strings are created consistently in this language (even if the admin is using the module admin page in a different language)
Comments
Comment #1
plachCleaning-up the "language system" issue queue as per http://cyrve.com/criticals.
Comment #2
Anonymous (not verified) commentedI can add some more examples of this issue. I made an base install profile for our company Drupal 6 projects. Our default language is pt_BR and in one of our projects, we installed the Simplenews module.
The Simplenews modules creates a content type ("Newsletter issue") on install using the
t()function (this isn't the problem either, we install it in a custom task when Drupal is fully bootstrapped inhook_profile_tasks()).Then, when I went to
node/add, I saw the Page and Story content types correctly translated (the translation of those content types are included in the default profile.pofile) and the Simplenews content type strings in English.Then, like
system_modules_submit()[1], we need to load the translations before installing the modules runninginstall_import_locales()[2] beforeinstall_profile_modules()[3] inincludes/install.core.inc. The only problem is thatlocale_batch_by_language()[4] inincludes/locale.incselects the enabled modules in system table but this is simple to override passing an extra array with the modules to be translated, refactoring the code a bit.Maybe it's too late for Drupal 7 but it would be a good change to Drupal 8. Non-english distributions would thanks it.
[1] http://api.drupal.org/api/function/system_modules_submit/7
[2] http://api.drupal.org/api/function/install_import_locales/7
[3] http://api.drupal.org/api/function/install_profile_modules/7
[4] http://api.drupal.org/api/function/locale_batch_by_language/7
Comment #3
gábor hojtsyI agree this should be done.
Comment #4
Anonymous (not verified) commentedYeah!
Comment #17
smustgrave commentedWonder after so many years and the current state of the langue module if this is still needed?
Comment #19
smustgrave commentedJust following up if still a valid task, if no follow up in 3 months going to close out. Thanks
Comment #20
jose reyero commentedAs the original reporter... though this has never actually been addressed, there are so many changes in the install system - like new strings being created mostly through configuration system - that this is not important anymore.
So, closing it for good... unless, of course, someone wants to start working on it after these 14 years (!!) :)