If I enable the Zen theme in my D7 the de.po is not imported through at all.

To reproduce:

1. I use a D7 from CVS and do a minimal install.
2. I activate the locale module and add the language .de. 0% of the strings are translated.
3. I use drush to download the Zen theme. It does contain a de.po.
4. Enable the theme and still have 0% translated strings.

I am running this through xdebug for some time now. All I can say is that the batch is set and everything seems to be working correctly. But I don't know where the batch should be executed.

This is the call stack:

drupal/modules/locale/locale.module.locale_system_update:808
drupal/includes/module.inc.call_user_func_array:0
drupal/includes/module.inc.module_invoke:732
drupal/includes/theme.inc.theme_enable:1252
drupal/modules/system/system.admin.inc.system_theme_enable:370
drupal/includes/menu.inc.call_user_func_array:0
drupal/includes/menu.inc.menu_execute_active_handler:480
drupal/index.php.{main}:22

This is the batch array:

Array
(
    [operations] => Array
        (
            [0] => Array
                (
                    [0] => _locale_batch_import
                    [1] => Array
                        (
                            [0] => sites/all/themes/zen/translations/de.po
                        )

                )

        )

    [title] => Importing interface translations
    [init_message] => Starting import
    [error_message] => Error importing interface translations
    [file] => includes/locale.inc
    [#components] => Array
        (
        )

    [finished] => _locale_batch_system_finished
)

My best guess is that the drupal_goto in system_theme_enable() ends the process and no batch is run. But if I just remove the drupal_goto() nothing changes. I still do not know D7 well enough. Sorry...

CommentFileSizeAuthor
#1 drupal.909348.patch1.56 KBartusamak

Comments

artusamak’s picture

Assigned: Unassigned » artusamak
Status: Active » Needs review
StatusFileSize
new1.56 KB

Because theme are now enabled through links instead of form submissions we need to run batch_process(), the problem is then that we are redirected to a wrong path (admin/appearence/enable) generating an access denied so we have to add a parameter to locale_system_update() to differenciate module activation from theme activation.
The following patch fixes the issue. Please review.

haza’s picture

Status: Needs review » Reviewed & tested by the community

Successfully tested using Zen theme (have a German translation)

- Add German language, activate Zen > no import

- Apply patch, add german language, activate Zen > German translation is imported.

dries’s picture

Status: Reviewed & tested by the community » Needs work

That is a hack. Locale module should not know about themes. We'll want to work on a better solution.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.