hello
providing a code snipet with support for the default i18n settings in the array, and also another sample for pathauto.
the difference here is that they are split into two blocks, by using array_push function to inject the new variables in the existing array.
by not combining everything in the same code chunk, it is more easy to add new variables suggested by modules in code snipets, or disable existing ones without necessitating a rewrite of the code.
i think it would be good to provide these in the documentation
/**
* Multilingual settings
*
* This is a collection of variables that can be set up for each language when i18n is enabled.
* These are the basic ones for Drupal core, but you can add your own here.
*/
//$conf['i18n_variables'] = array(
if (!is_array($conf['i18n_variables'])) $conf['i18n_variables'] = array(
// Site name, slogan, mission, etc..
'site_name',
'site_slogan',
'site_mission',
'site_footer',
'anonymous',
// Different front page for each language
'site_frontpage',
// Primary and secondary links
'menu_primary_links_source',
'menu_secondary_links_source',
// Contact form information
'contact_form_information',
// For theme variables, read more below
'theme_settings',
'theme_garland_settings'
);
/**
* Multilingual settings - Pathauto
*
* Variables for Pathauto usage.
*/
if (is_array($conf['i18n_variables'])) array_push($conf['i18n_variables'],
// pathauto
'pathauto_node_pattern', // General pattern for nodes
'pathauto_node_blog_pattern', // Pattern for blog nodes
'pathauto_node_forum_pattern', // Pattern for forum nodes
'pathauto_node_poll_pattern', // Pattern for poll nodes
'pathauto_node_story_pattern', // Pattern for story nodes
'pathauto_node_page_pattern', // Pattern for page nodes
'pathauto_node_book_pattern' // Pattern for book nodes
);
posted the same code for i18n module here:
http://drupal.org/node/945660
Comments
Comment #1
dave reidWe already expose per-language pattern variables/fields for each node type if locale.module is enabled, so I'm not sure why this is necessary?
Comment #2
lpalgarvio commentedmy suggestion is not mainly which variables are added, but more like, how they are added
by adding in separate code blocks, there is more dynamics with configurations, which could also result in less errors committed by the users trying to install Pathauto, and in turn, less support requests in the issue queue.
it also makes the configuration code more clean, more visible, and easier to disable parts here and there, without rewriting everything, as noted above.
the snipet bit that does what i'm saying is just the IF clause followed by the array_push:
Comment #3
lpalgarvio commentedthis is related to this thread
http://drupal.org/node/313262
Comment #4
dave reidThat documentation is completely wrong and does not actually work properly with Pathauto. There are *already* per-language variables defined by pathauto.
Comment #5
lpalgarvio commentedi'll state that in the documentation thread.
thanks
edit:
i've noticed that neither of those variables worked, but i assumed it was a glitch, since they were listed in that documentation thread. i also assumed these were an extension to the already existing ones.
they show up as multilingual, but they don't work (at least in the 2.x series).
if pathauto does not support any defined i18n variables in settings.php, i will suggest closing this issue; no point continuing with this discussion. pathauto method, through an API, is better anyways.
the method has been shared around and i've posted your remarks on pathauto vs i18n on the relevant threads/issues so other people are informed.
Comment #6
dave reidYou can set the language variables directly. They're defined like this:
Since there's nothing more we can really do here in this issue queue, marking as fixed.