oneaionut Posted June 1, 2012 Share Posted June 1, 2012 I am having some issues with the paypal translations. The translations in "Translate installed modules" are ok in the backend and they update on save. But on the order summary they are not loaded at all ' "paypal/payment/submit.php" giving me the default english values. When checked if the translation variable is properly set i had no issues. I am running Prestashop "1.4.7.3" . Any suggestions? All other modules translations work fine and paypal is having issues only on that page. I checked if the language variable is set properly and it is set to "de". Any suggestions? Link to comment Share on other sites More sharing options...
Yenibosnaweb Posted June 8, 2012 Share Posted June 8, 2012 I have similar problem the paypal language is seems to be in English eventhougt the translation. I can not change the module translation. please help Link to comment Share on other sites More sharing options...
oneaionut Posted June 8, 2012 Author Share Posted June 8, 2012 I have similar problem the paypal language is seems to be in English eventhougt the translation. I can not change the module translation. please help Are you experiencing the same issue as described by us where you can edit the translation file but it does not get reflected in the front-end final step or are you getting and error when saving the translation? Link to comment Share on other sites More sharing options...
senolage Posted August 24, 2012 Share Posted August 24, 2012 (edited) I believe I stumbled upon the same issue and here's how I solved it: [tldr] Translate the xml for country iso_code='RE' in the file 'modules/paypal/translations.xml' or maybe another one of the iso_codes already present. Don't try to create a new one (at least as of version 3.0.9 of the paypal module). [/tldr] With the new version of the paypal module, a new block of translations is done in a XML file: modules/paypal/translations.xml One of the problems with this, is that PrestaShop doesn't recognize these strings as needed to be translated. The problem in a shop that was in Brazilian was that it would still use the English strings even though I created a new xml country element for iso_code=BR, but had no effect. Then, I went to investigate why that happened, and the paypal module "translates" you shop's iso_code to an internal code, in this case: RE (I believe that it stands for "rest of the world"). The module uses this translated "iso code" both to get the translations and the specific rules (like options available) for each country/zone. In my opinion, this should be changed and the translation should only use that code as a fallback and first try to get a translation with the shop's ISO CODE, and only if not found, try to get the with the "internal iso code" and finally use the "default" translation. Code example for function getTranslations (around line 718 of paypal_abstract.php): if (isset($xml) && ($xml != false)) { $index = -1; $content = array(); $default = array(); $shop_country = (int)Configuration::get('PS_COUNTRY_DEFAULT'); while (isset($xml->country[++$index])) { $country = $xml->country[$index]; $country_iso = $country->attributes()->iso_code; if ($country_iso == 'default') { $default = (array)$country; continue; } if ( $country_iso == $shop_country ) { $content = (array)$country; break; } else if ($country_iso == $this->iso_code) { $content = (array)$country; } } $content += $default; $this->context->smarty->assign('PayPal_content', $content); return true; } Edit: Fix erroneous file name and line. Edited September 11, 2012 by senolage (see edit history) 1 Link to comment Share on other sites More sharing options...
ILLEX-MEDIA Posted September 11, 2012 Share Posted September 11, 2012 Hello, hmm sorry my english its not so good =( I not understand what i must make? You post a php code this come in the translation.xml ??? im confused My ISO code "DE" exsists in the translation.xml but i think presta use this ISO not but why? Regards, Stefan Link to comment Share on other sites More sharing options...
ILLEX-MEDIA Posted September 11, 2012 Share Posted September 11, 2012 (edited) Hmm okay, i have replace the olde code with your new code and become now a error =( my file at 719 not 718 public function getTranslations() { if (isset($xml) && ($xml != false)) { $index = -1; $content = array(); $default = array(); $shop_country = (int)Configuration::get('PS_COUNTRY_DEFAULT'); while (isset($xml->country[++$index])) { $country = $xml->country[$index]; $country_iso = $country->attributes()->iso_code; if ($country_iso == 'default') { $default = (array)$country; continue; } if ( $country_iso == $shop_country ) { $content = (array)$country; break; } else if ($country_iso == $this->iso_code) { $content = (array)$country; } } $content += $default; $this->context->smarty->assign('PayPal_content', $content); return true; } return false; } "NOTICE UNDEFINED INDEX: PAYPAL_CONTENT" When replace from this line: if (isset($xml) && ($xml != false)) than it is 732 I use OPC (Presta 1.4.9) and bottom of this site its default english and translate nothing also only paypal is not translated all other payment moduls for select is translated. Regards Edited September 11, 2012 by ILLEX-MEDIA (see edit history) Link to comment Share on other sites More sharing options...
senolage Posted September 11, 2012 Share Posted September 11, 2012 I haven't tested the code, it probably doesn't work since it might be using a wrong value for $shop_country and should instead be the two letter iso country code. The code was intended just as a hint for the module developers (or other developers) to base upon. Anyway, is your store's default language set to English? If so, I believe that's the reason and that the module only translates to the default shop's language. Link to comment Share on other sites More sharing options...
senolage Posted September 11, 2012 Share Posted September 11, 2012 Hmm okay, i have replace the olde code with your new code and become now a error =( my file at 719 not 718 public function getTranslations() { if (isset($xml) && ($xml != false)) { $index = -1; $content = array(); $default = array(); $shop_country = (int)Configuration::get('PS_COUNTRY_DEFAULT'); while (isset($xml->country[++$index])) { $country = $xml->country[$index]; $country_iso = $country->attributes()->iso_code; if ($country_iso == 'default') { $default = (array)$country; continue; } if ( $country_iso == $shop_country ) { $content = (array)$country; break; } else if ($country_iso == $this->iso_code) { $content = (array)$country; } } $content += $default; $this->context->smarty->assign('PayPal_content', $content); return true; } return false; } You overwrote the initial part of the function (which is necessary): public function getTranslations() { $file = dirname(__FILE__) . '/' . _PAYPAL_TRANSLATIONS_XML_; if (file_exists($file)) { $xml = simplexml_load_file($file); } else { return false; } Link to comment Share on other sites More sharing options...
ILLEX-MEDIA Posted September 11, 2012 Share Posted September 11, 2012 No i have german a default set. Hmm its a Sample code for Modul-developer not a fix? Sad! I have replace with und without this: public function getTranslations() { $file = dirname(__FILE__) . '/' . _PAYPAL_TRANSLATIONS_XML_; if (file_exists($file)) { $xml = simplexml_load_file($file); } else { return false; } But all will not work, on frontoffice come only the default language Link to comment Share on other sites More sharing options...
senolage Posted September 11, 2012 Share Posted September 11, 2012 It was intended as a starting point for a discussion on how to get the effectively desired translation from the module but since your attitude seems like others have to do the hard work for you, I guess I just won't spend more time with you, sorry. Maybe if I end up getting some time to investigate and test the solution I'll post it here. Have fun. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now