Reputation: 313
I'm creating a Wordpress theme that will be translated from English into French. I've included all string using Wordpress's gettext functions.
BUT
I want to print the French version of one specific string on the English version of the site, and vice versa. I tried this (on the English version):
_e('version française', 'mydomain');
but then Poedit complained about a non-ASCII string. So, at present, in the English version I've got
_e('French version', 'mydomain');
How can I output the French translation of that string, even though the locale is set to use English?
Upvotes: 0
Views: 437
Reputation: 808
Your error has something to do with character set used for extraction of template. But you problem has not. After all, do you have string 'version française' in your code? Do you want translators to translate this string from english to other languages? No? The use simply echo 'version française'. No translation on already translated string, ok?
If you ever need only English and French translations, your way is ok. But if you need more languages in future, this way it will not work. What about Spanish and Russian version? I suggest to get list of language names in their own languages. And use some kind of drop down menu for language change, where it will have Russian in azbuka, Espanol for Spanish etc. Make it to predefined array away from normal translated files, as language names will be already as they are. People understanding those languages will recognize their own languages anyway. Prefix it with _e('Language: ', 'mydomain'); to be sure.
Upvotes: 1
Reputation: 138
Check if the file encoding for source and file are set properly. Also in poEdit, go to Catalog > Settings and check the properties in the Source Code charset. Try with UTF-8.
Upvotes: 0