i tried using the localized.profile example in CVS. I copied over

function myprofile_install() {
  _autolocale_install_po_files();
}

but this one is executed tooo early. My problem is that i'd like to install a theme and the myprofile_profile_final() is executed after myprofile_install(). In this case the profile_final hook haven't yet added the themes page.tpl.php to my system table and additional the theme is not activated when _install hook fires. i'm doing the activation inside myprofile_profile_final(). In this case the themes PO files are not imported!

So i tried to solve this in a way that i moved _autolocale_install_po_files(); to the last line of the function myprofile_profile_final(). But i'm not sure if this is the recommended and planed way!???

Comments

gábor hojtsy’s picture

Status: Active » Closed (won't fix)

How is this issue related to the *Documentation of autolocale*? There is no documentation here suggesting you that you should work with hook_install() or hook_profile_final() or whatever. If you are building an install profile you should master the documentation on this topic, which details how these hooks are loaded.

In the case of autolocale, there is no conflict, because we are not doing anything in profile_final() which should have precede translation imports.

hass’s picture

Version: » 5.x-1.x-dev
Component: Documentation » Code
Category: support » bug
Status: Closed (won't fix) » Active

ok, possibly wrongly marked. It took me hours to find out why my theme PO wasn't imported. If i install themes together with your example "localized.profile" the theme PO is not imported.

To solve this bug - the following should be removed:

/**
 * Uses functionality in autolocale.install to import PO files
 */
function localized_install() {
  _autolocale_install_po_files();
}

and this added:

function localized_profile_final() {
  // do everything that should be done...

  // add the page.tpl.php to the system table...

  // now we are able to import the themes PO files here
  _autolocale_install_po_files();
}
gábor hojtsy’s picture

Why would we add a page.tpl.php to the database? From what theme?

hass’s picture

i've build a profile package with a custom theme (i'm not talking about garland) and i'd like to deliver this custom theme to the users in an easy installer. So i created a multilingual package with "YAML for Drupal" theme http://www.yaml-for-drupal.com/ and the upcoming version of YAML Theme have a PO file, this file is *currently* not imported with autolocale.

I don't know why, but autolocale will not import theme PO's until the theme is listed in the system table...

hass’s picture

autolocale will currently not import the theme PO without the above change...

gábor hojtsy’s picture

Category: bug » task
Status: Active » Fixed

Well, you created your own profile, right? It had a bug because it had different requirements then localized.profile. Why is this a bug in localized.profile?

Although it is surely not a bug, I have modified the localized.profile, because as it seems from the code, our requirements are met by either implementation (localized_install() is called at the end of the drupal_install_profile(), which is only a few lines away from install_complete() which calls the final install hook).

hass’s picture

ok let's go a step back... :-)

1. unpack drupal
2. put your localized.profile in "profile/localized" directory and don't touch the profile
3. place my theme with an PO file in the "sites/all/themes/mytheme" directory
4. run the installer.
5. mytheme PO's are not imported

Now where is the bug? In my theme or your profile?

yes, i've build my own install package... i read the bad and buggy handbook (HOWTO: Write an installation profile for the Drupal installer http://drupal.org/node/67921) about the installer profile. There is nothing inside regarding language imports... Be assured, if you will not change your "example" or the handbook page regarding this - others will have the same problem as i have. i think, we should not reinvent the wheel every day, isn't it?

gábor hojtsy’s picture

If you don't touch the localized profile file, it will not add your custom theme to the system table (garland is added by default by Drupal and nothing else as far as I seem). So it is not surprising that translations for your theme are not imported. I did remove localized_install() and did call autolocale_install_po_files() at the end of profile_final() but this does not help you, your theme is still not added to the system table.

This is not a bug in autolocale nor Drupal, this is a missing feature. How would we know about some theme you would like to add if you don't tell Drupal so (ie. you are using an unmodified install profile)?

hass’s picture

Really, i think there is another not implemented "feature"... i'd like to name this more like a bug someone missed to test. If the installer is running, it should automatically *first* add all themes (as an example) existing on the disk to the system table... no matter of theme is active or not! This makes some things easier for the install profiles. This step is also done if i press "save" on the themes selection page and this should be implemented in the installer, too.

gábor hojtsy’s picture

Well, you can file a bug report against the Drupal installer component. This changed behavior would not change the situation a bit, because those themes will not get enabled by default, so autolocale would not import translations for them. Autolocale only imports translations for enabled modules/themes on purpose, the very reason to implement autolocale was to not import stuff you don't need (~ enable) on a site.

Anonymous’s picture

Status: Fixed » Closed (fixed)