WordPress | WPML import English .po translation
For a customer i developed a multilingual website using WPML.
Principal language is Italian It, and secondary language English, so i installed wpml with default language set on Italian.
Our customer need to have a .po file that he can translate by poEdit, so i export from wpml the .po file that contain all strings to translate.
The problems comes when try to import the “translation-en.po”.
WPML don,t permit to import a English.po files, because ” of some limitation made be the developers, and they will fix this in a future versions “, that is what was write on WPML support forum in “Mrch 2017”, at the moment of this post (October 2019 ), the situation is the same.
If i try to import a .po file from “WPML -> String translation -> Import Export .po”, can’t view “Eng” language in the “Also creates translations based on the .po file” Select.
Thank’s to WPML Support Forum, i found a solution:
Open from plugin “wpml-string-translation -> Menu” folder the “string-translation.php” file and change this line:
<?php foreach($active_languages as $al): if($al['code']==$string_settings['strings_language']) continue; ?>
in
<?php foreach($active_languages as $al): ?>
In the file, you have 2 points where change this string :
line – 613
line – 675
After this reload page in “WPML -> String translation -> Import Export .po”:
No w you can import English.po file.
and than ou can re associate the strings between Italian and English.
That’s All.