Integrate the Polyglot langage setting in the WP e-Commerce setting (as a hack)
-
Hi.
Now, for 3 days stuck on this problem: hack to make the plugin polyglot.php “inject” the language to set to wp-shopping-cart.php.Unfortunately, I’m ways farrer than my php skills…
Sure it would be vanilla ice cream for any php newbie…
Anyway, here’s my work :
In e-commerce, it seems that the language is taken, once, from the admin langage selector, that is managed in wp-shopping-cart.php at line 25 :
if(get_option('language_setting') != '') { include_once(ABSPATH.'wp-content/plugins/wp-shopping-cart/languages/'.get_option('language_setting')); } else { include_once(ABSPATH.'wp-content/plugins/wp-shopping-cart/languages/EN_en.php'); }
In polyglot.php, I create a new function that return exactly the right string that is required by wp-shopping cart, for exemple :
/Applications/MAMP/htdocs/wpen/wp-content/plugins/wp-shopping-cart/languages/fr_FR.php
function polyglot_wp_cartlang(){ // sort la langue préférée qui est récupérée par shopping-cart comme langue global $polyglot_settings,$wplanglang; $wplanglang = $polyglot_settings['wplang'][$polyglot_settings['lang_pref']] ; return (ABSPATH.'wp-content/plugins/wp-shopping-cart/languages/'.$wplanglang.'.php'); }
Then, in wp-shopping-cart.php, I comment the above selector code that I replace by
include_once(polyglot_wp_cartlang()) ;
The problem is that, while I can control that my function polyglot_wp_cartlang() return the right string (that I ensure having echoed it in the sidebar template), it don’t “refresh” when called by wp-shopping-cart.php.
In other words, it stay in fr (that is the default browser language).I suspect the scripts execute following a certain order and my issue is that e-Commerce run once, before Polyglot…
Here it is.
As I said, I’m stuck.
Hope to meet somebody who can help me.
Thanks in advance.
—
fxbodin
- The topic ‘Integrate the Polyglot langage setting in the WP e-Commerce setting (as a hack)’ is closed to new replies.