0

I would like to know how I could create a file in which I could associate a word in multiple languages. Let's make an example in XML:

<item key="goodMorning>
    <copy lang="en">Good morning<copy>
    <copy lang="fr">Bon matin<copy>
    <copy lang="nl">Goedemorgen<copy>
</item>

Is there such a file, or many files, that would be available for me to output a certain string to the front end according to the language? (It doesn't have to be XML at all, as long as it works in Wordpress).

This info (http://wpml.org/documentation/getting-started-guide/language-setup/custom-language-switcher/) allows me to get what is the current language, but I'd like to act accordingly.

I already use the WPML (paid) plugin, I asked the question over there as well, to no avail so far. If anyone could help, it'd be appreciated.

1 Answer 1

0

You just need to set your words in a WordPress translation tag in your theme:

<?php _e('Goedemorgen','yourthemename');?>

And with the WPML string translation tool you can scan for these strings and give the appropriate translation. That's how I do it with the paying WPML plugin. Works like a breeze.

No need to make your own pot translation files (that's maybe the answer you were initially looking for, but the WPML plugin makes things easier)

2
  • Thanks for the guidance, with that I managed to translate a lot. However, my child theme requires additional strings, how do I add those strings? I'd rather avoid touching the parent theme.
    – jansensan
    Oct 29, 2012 at 17:20
  • You can add that code too to your child theme instead of only the main theme. The 'yourthemename' can be anything. You can also name it 'yourchildthemename'.
    – Pieter
    Nov 7, 2012 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.