When installing a module through the web interface, Drupal automatically imports the language files (.po) that exist for the currently enabled languages. Drush skips this process, so when you use it to build a non-English website you end up with a mostly untranslated interface.

Comments

moshe weitzman’s picture

Priority: Normal » Critical

Upgrading to critical for next release. At minimum, should work for D7. D6 would be very nice ... Help wanted.

floretan’s picture

Right now I've been doing a drupal_execute() to add a language after everything is built, which loads all available translations for that language, but it's just a workaround...

It'd be nice if the locale import code wasn't so batch-oriented. Right now system.module calls module_invoke('locale', 'system_update' ... when enabling a module or a theme, which starts a batch. I'm guessing the way to deal with this is to call our own locale update function when enabling a module or theme.

moshe weitzman’s picture

Category: bug » feature
moshe weitzman’s picture

Title: Drush doesn't import translation files » Drush doesn't import translation files in D6
Priority: Critical » Normal

I tried this out for D7 and it works! We already do a drupal_form_submit() [new name for drupal_execute] on the modules page and in D7, the batch proceeds in non-progressive mode.

Would be nice to solve this for D6 but I think it will be painful in terms of code duplication.

moshe weitzman’s picture

I just added a --locale option to installsite command. It now imports translations at install time.

floretan’s picture

Status: Active » Fixed

Just tested it on a French project. Works as expected. Thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nhck’s picture

Category: feature » bug
Status: Closed (fixed) » Active

Hello, I ran the following command with July 2nd HEAD:
drush en auto_nodetitle fieldgroup filefield imagefield number content_profile content_profile_tokens content_profile_registration profile_migrate logintoboggan sharedemail weight

and it didn't import any translations for those modules.

moshe weitzman’s picture

@Neils - you were using D7?

nhck’s picture

I am using D6

moritzz’s picture

There seams to exist, however, a workaround for D6: You can explicitly force the import of language files of a certain module:

drush php-eval "locale_system_update(array('poll')); drush_backend_batch_process();"

Good Luck,
Moritz

nhck’s picture

Today I did:

 drush en panels

and this happend:

WD locale: 3 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 10 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 10 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 10 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 10 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 10 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 10 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 11 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 11 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 11 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 11 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 11 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 11 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 11 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 11 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 12 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 14 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 14 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 14 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 14 translation strings were skipped because they contain disallowed HTML. [warning]
WD locale: 14 translation strings were skipped because they contain disallowed HTML. [warning]
panels was enabled successfully. [ok]

So there must be somekind of import..

moritzz’s picture

Huh? I'm quite sure, language files of Poll weren't imported on:

drush pm-enable -y poll

What version of drush do you use?

David Stosik’s picture

Subscribing.
Any news about this issue, on D6 ?

Marvine’s picture

Component: Code » PM (dl, en, up ...)

Thanks for :

drush php-eval "locale_system_update(array('poll')); drush_backend_batch_process();"

It works like a charm !

ceooph’s picture

Subscribe

jonhattan’s picture

Assigned: Unassigned » jonhattan

I've made some tests and it works for drupal 6 as long as po files are in translations/ in the .module directory; but it's needed to clear some cache.

jonhattan’s picture

Status: Active » Fixed

It seems I did already had cache poisoned with untranslated strings. Testing with a fresh downloaded project just works.

Other note: translations are only imported when project is installed (first time you enable it). You need to uninstall before enabling again to trigger the import routine. Perhaps that was the case for @nhck in #10.

Didn't say: I did test in drupal 6.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.