Jump to content

[solved] country name in spanish and not in language chosen by customer


Recommended Posts

Language packs are incomplete, they don't contain all translations. Just days before the 1.5.4 release, the multi-language installation was disabled. The unforeseen consequence was that some translations are not available via language packs. Countries' as you experienced but many more little things : date format, order state etc.

 

See http://forge.prestas...wse/PSCFV-8720. There's a fix but it only works during a new installation.

Edited by emily_d (see edit history)
Link to comment
Share on other sites

well.. i have tried to do the installation from scratched. and once i copy the data base and my prestashop folders remains unchanged.

 

i might not be finding the solution for that.

I tried the install thing from the module folder and has not work it would not let me further installation.

any more ideas

 

regards

Link to comment
Share on other sites

well.. i have tried to do the installation from scratched. and once i copy the data base and my prestashop folders remains unchanged.

 

If you tried the fix I mentioned above, you need to understand that the missing translations are part of the database, so if you copy your database it will not work. As I said it only works for a new installation.

Link to comment
Share on other sites

OK!!! that worked now the other issues many many thanks both of you

 

 

Following yout advice. I have a cheao long shot way of sorting it out.

 

I will see the countries that are withing my shipping range and I will edit one by one and change their name from spanish to english, latvian or what ever they are.

 

As some one said there is not urgent things just people in a hurry.

 

if some figures out a solution that does not need this long process, and does not involve losing my database, please post it.

Edited by kenkokafe (see edit history)
Link to comment
Share on other sites

if some figures out a solution that does not need this long process, and does not involve losing my database, please post it.

 

It's possible but there's no easy way, cause the language ids are probably different.

 

Also it's possible to write a script to import the xml files that are in "install\langs\en\data" in the .zip of a new Prestashop install. There you'll find all the missing translations.

 

The format is like this :

 

 

<?xml version="1.0"?>
<entity_gender>
 <gender id="1" name="Mr."/>
 <gender id="2" name="Ms."/>
 <gender id="3" name="Miss"/>
</entity_gender>

 

So you'll need a script that will read this xml and then make a SQL update on the database with something looking (that's no working code !) :

 

 

UPDATE ps_gender_lang
SET name=value_from_xml
WHERE id_lang= english_id;

 

Then this needs to be done for all xml files in "install\langs\en\data".

 

For countries :

 

 

<?xml version="1.0"?>
<entity_country>
 <country id="DE">
<name>Germany</name>
 </country>
 <country id="AT">
<name>Austria</name>
 </country>
 <country id="BE">
<name>Belgium</name>
 </country>
 <country id="CA">
<name>Canada</name>
 </country>
 <country id="CN">
<name>China</name>
 </country>
 <country id="ES">
<name>Spain</name>
 </country>
 <country id="FI">
<name>Finland</name>
 </country>
...

 

and

 

UPDATE ps_country_lang
SET name=value_from_xml
WHERE id_lang= english_id;

 

but here you should get the country id before updating.

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

Thanks to your suggestions, I've wrote down a couple of rows to update the country names for the english language.

 

As suggested, I've picked the file country.xml inside the folder /install/langs/en/data .

 

I've copied it into the admin folder and I've created, in the same folder, a file named tool.php, with the following lines:

<?php

define('_PS_ADMIN_DIR_', getcwd());
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility

include(PS_ADMIN_DIR.'/../config/config.inc.php');

$countries= simplexml_load_file(dirname(__FILE__).'/country.xml');

foreach ($countries as $row)	
	DB::getInstance()->execute("UPDATE "._DB_PREFIX_."country_lang SET name = '".$row->name."' WHERE id_lang = 2 AND id_country = (SELECT c.id_country FROM "._DB_PREFIX_."country c WHERE c.iso_code = '".$row['id']."')");
	

echo 'done';

?>

In my case, the english language id was 2 (id_lang = 2), so you should change it with your own.

 

The same code, with the right changes, can be used for almost every language table present into the install folder.

 

I hope this code can be helpful to someone.

  • Like 1
Link to comment
Share on other sites

  • 4 months later...
  • 10 months later...

This works for me,

 

Many thanks :)

 

 

Thanks to your suggestions, I've wrote down a couple of rows to update the country names for the english language.

 

As suggested, I've picked the file country.xml inside the folder /install/langs/en/data .

 

I've copied it into the admin folder and I've created, in the same folder, a file named tool.php, with the following lines:

<?php

define('_PS_ADMIN_DIR_', getcwd());
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility

include(PS_ADMIN_DIR.'/../config/config.inc.php');

$countries= simplexml_load_file(dirname(__FILE__).'/country.xml');

foreach ($countries as $row)	
	DB::getInstance()->execute("UPDATE "._DB_PREFIX_."country_lang SET name = '".$row->name."' WHERE id_lang = 2 AND id_country = (SELECT c.id_country FROM "._DB_PREFIX_."country c WHERE c.iso_code = '".$row['id']."')");
	

echo 'done';

?>

In my case, the english language id was 2 (id_lang = 2), so you should change it with your own.

 

The same code, with the right changes, can be used for almost every language table present into the install folder.

 

I hope this code can be helpful to someone.

Link to comment
Share on other sites

×
×
  • Create New...