Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › Multilanguage support
Tagged: e-store, eMember, estore, Languages, Multi language, multible language, multilanguage, multilingual, multiple languages, qTranslate, translate, Translation, wpml
- This topic has 40 replies, 14 voices, and was last updated 6 years, 7 months ago by admin.
-
AuthorPosts
-
January 27, 2012 at 6:59 am #37660adminKeymaster
I was just wondering… isn’t it better to use a plugin like the following that uses Google translator?
January 28, 2012 at 11:12 am #37661akaigotchiMemberThe content of getCurrentLanguage() (changed the name due to coding conventions) is:
function getCurrentLanguage(){
return ICL_LANGUAGE_CODE;
}
ICL_LANGUAGE_CODE is supposed to be a constant, that can be called from within the theme. I think the problem is, that wp_estore1.php cannot “see” the functions within my functions.php (residing in theme dir). Is there any way to make wp_estore1.php “see” values that are generated within the theme or within functions.php? This way I could easily read the value of the Constant…
January 28, 2012 at 11:13 am #37662akaigotchiMemberTo use a Google Translator module is not such a good idea, if you want to have correct (readable) translations from German to English. The site I am working for is a mutlilingual magazine, that relies heavily on correct language. But thanks for the idea anyway Still was worth considering…
January 29, 2012 at 4:58 am #37663adminKeymasterLets do something similar to what we did with qTranslator.
WPML Integration Tweak
1. Open the “wp_eStore1.php” file and find the following block of code:
$cart_language = get_option('eStore_cart_language');
if (!empty($cart_language))
$language_file = "languages/".$cart_language;
else
$language_file = "languages/eng.php";
include_once($language_file);2. Once you find it, replace it with the following block of code:
function wp_eStore_load_wpml_lang()
{
if(!defined('ICL_LANGUAGE_CODE')){
$language_file = "languages/eng.php";
}
else if (ICL_LANGUAGE_CODE == "en"){
$language_file = "languages/eng.php";
}
else if (ICL_LANGUAGE_CODE == "de"){
$language_file = "languages/ger.php";
}
else if (ICL_LANGUAGE_CODE == "fr"){
$language_file = "languages/fr.php";
}
include_once($language_file);
}
add_action('plugins_loaded', 'wp_eStore_load_wpml_lang');Let me know how that goes. For debugging purpose you can try echoing the value of the “ICL_LANGUAGE_CODE” constant to see if it shows the correct value. eStore will only be able to load a file that is stored inside the “languages” folder (if the file name do not match it won’t load it).
January 30, 2012 at 11:48 am #37664akaigotchiMemberHi,
this works like a charm. Thank you very much! Still one issue: I need to override the settings of the “Add to Cart Button Text or Image” and “Shopping Cart Widget Title” I set in the backend settings. Is there a constant for that defined in your language files?
BTW, I think integration of WPML/qTranslate would be a great feature. I could imagine it would be nice to have a backend switch similar to the Mailchimp switch (“Use WPML” / “Use qTranslate”) and to have a simple IF-Statement to request the status of that switch. What do you think?
Best regards
Thorsten
January 30, 2012 at 11:51 am #37665akaigotchiMemberOh, maybe to add to the solution: I duplicated the “ger.php” file and renamed it to “de.php” to make it match to the output of ICL_LANGUAGE_CODE, similar with “eng.php” to “en.php”.
June 29, 2012 at 3:43 pm #37666catohansenMemberHey,
How do i add a new language so it wont be gone when i update plugin, if it comes with a new update ?
June 29, 2012 at 3:44 pm #37667catohansenMemberI can translate the file and everything to Norwegian and want this in ??
Cheers…
June 30, 2012 at 2:03 am #37668adminKeymasterIf you translate the file to your language please send us the language file (use the contact form on the site to get in touch with us).
July 27, 2012 at 5:07 pm #37669clausMemberHi,
I have a problem with setting up eMember together with WPML. I’ve added some lines of code to the file wp_eMember1.php (see below) to get the problem solved. This is working like a charm with other plugins but unlikely not with eMember as it seems that the constant ICL_LANGUAGE_CODE is not available at the runtime of wp_eMember1.php. Can anybody help please
Here’s the code I added :
if (!empty($lang))$eMember_language_file = “lang/”.$lang.”.php”;
else $eMember_language_file = “lang/eng.php”;
/**************************************************************
*** Added to change language file according to WPML setting ***
***************************************************************/
if (defined(‘ICL_LANGUAGE_CODE’)) {
$wpml_lang=ICL_LANGUAGE_CODE;
switch ($wpml_lang) {
case “en”:
$eMember_language_file = “lang/eng.php”;
break;
case “de”:
$eMember_language_file = “lang/ger.php”;
break;
case “fr”:
$eMember_language_file = “lang/fr.php”;
break;
default: //Switch back to english if language is not recognized
$eMember_language_file = “lang/eng.php”;
break;
}
}
/*********************
/*** End of change ***
**********************/
include_once($eMember_language_file);
For info : My eMember is set to German. With the line ‘ if (defined(‘ICL_LANGUAGE_CODE’)) {
‘ in the code it shows up in german, if I delete the line it switches back to english independent of which language is selected in WPML, so the code ends up with the default: setting.
Hope somebody can help
July 28, 2012 at 6:36 am #37670adminKeymasterTry the following for WP eMember:
1. Open the “wp_eMember1.php” file and find the following block of code:
$lang = $emember_config->getValue('eMember_language');
if (!empty($lang))$eMember_language_file = WP_EMEMBER_PATH ."lang/".$lang.".php";
else $eMember_language_file = WP_EMEMBER_PATH."lang/eng.php";
$eMember_language_file = apply_filters('emember_get_language_path', $eMember_language_file, $lang);
include_once($eMember_language_file);2. Once you find it replace it with the following block of code:
//Specify which language file to load based on WPML language selection
$language_file = 'lang/'.ICL_LANGUAGE_CODE.'.php';
include_once($language_file);December 7, 2012 at 4:48 am #37671rgranzotiMemberI am trying to get eStore integrated with WPML as well, however I was not able to find the aforementioned block of code:
$lang = $emember_config->getValue(‘eMember_language’);
if (!empty($lang))$eMember_language_file = “lang/”.$lang.”.php”;
else $eMember_language_file = “lang/eng.php”;
include_once($eMember_language_file);
I was able to find this, however:
$cart_language = get_option(‘eStore_cart_language’);
if (!empty($cart_language))
$language_file = “languages/”.$cart_language;
else
$language_file = “languages/eng.php”;
include_once($language_file);
At any rate, an error message came up. I tried using i18n too, btw, without luck. Base language is pt-br (brazilian portuguese), and I would like to be able to sell products in English in the near future. Currently I have eng.php translated into pt-br and just use that.
How should I proceed? Thank you bunches!
December 8, 2012 at 12:21 am #37672adminKeymasterThe code you were looking for is for WP eMember plugin.
First undo any change you have done then Try the following for WP eStore:
WP eStore and WPML Plugin Integration Tweak
Step 1) Open the “wp_eStore1.php” file and find the following block of code:
$cart_language = get_option('eStore_cart_language');
if (!empty($cart_language))
$language_file = "languages/".$cart_language;
else
$language_file = "languages/eng.php";
include_once($language_file);Step 2) Once you find the above code block, replace it with the following block of code:
function wp_eStore_load_wpml_lang()
{
//Specify which language file to load based on WPML language selection
if (defined('ICL_LANGUAGE_CODE')) {
if (ICL_LANGUAGE_CODE == "en"){
$language_file = "languages/eng.php";
}
else if (ICL_LANGUAGE_CODE == "de"){
$language_file ="languages/ger.php";
}
else if (ICL_LANGUAGE_CODE == "fr"){
$language_file = "languages/fr.php";
}
}
else{
$language_file = "languages/eng.php";
}
include_once($language_file);
}
add_action('plugins_loaded', 'wp_eStore_load_wpml_lang');May 16, 2013 at 6:41 am #37673mihulkovaMemberHi, I am trying to create an e-shop with digital products, my default language is Czech and now I am trying to translate into German and English. I have bought e-Store, PDF-Stamper and also WPML. I was able to translate all the sites with WPML and also some strings in plugins, but I am not able to find out how to translate the strings from e-Store plugin! I mean the names of categories and products…
I hope it doesn’t mean that I have to create the same shop 3 times, each one for one language! I am worry I won’t be able to provide any changes in the code…
Could you help me, please? I need to know if it is possible to translate the products and categories and perhaps the texts in the shopping cart etc. with WPLM or another plugin OR if I have to have a separate shop for each language.
Thank you so much in advance!
Dana
May 17, 2013 at 5:19 am #37674adminKeymasterYou can obviously try to have different WP Install for the different languages but the WPML plugin should work fine with eStore. Have you tried the above mentioned tweak (read the post just above your post)?
-
AuthorPosts
- You must be logged in to reply to this topic.