This article shows how you can keep your Genesis translations secure in your child theme, in case you need a custom or formal translation.
The Genesis Wordpress framework texts are easy to translate in any other language. The plugin Genesis Translations from Remkus de Vries has already most of what you need for your website. But in some cases your customer demands to have customized or formal translations of a language.
Formal versus informal translation
In Germany and sometimes in the Netherlands customers don't want the informal form of translations.
- Informal: English: you, German: du/dein, Dutch: je/jij/jouw.
- Formal: English: you, German: Sie/Ihr, Dutch: U/uw.
Usually on internet the etiquette goes on informal, but in some profession groups this is not so common. In Germany it is in many cases very uncommon to address your communication partner the informal way.
How to keep it formal
With the help of the free translation program Poedit, and a bit of creativity in your child theme you can make it work.
Remkus de Vries made an awesome Genesis Translations plugin for Wordpress, but any update of this plugin would overwrite your customized translations. The following steps give a better control over your translations.
- Install the Genesis Translations plugin but don't activate it. You still will be notified on updates. Custom translations probably hold for a whole release (2.0 til 2.99 or so).
- Create in your child theme folder a folder named languages (if it is not already there)
- Create in this folder (languages) a new folder named genesis.
- Copy the language files for your language from the Genesis Translations Plugin languages to the genesis folder you have created in step 3. Copy both the .po and the .mo files you need.
- Copy the .po file to your computer and make modifications to the .po file with Poedit. Save the file in Poedit.
The will update the existing .mo file with the same name. Copy the .po and .mo files back to your /languages/genesis folder within your Wordpress installation.
- Now let's modify the functions.php of the child theme.
Define where Genesis has to take the translations from
Define this after the
define('GENESIS\_LANGUAGES\_DIR', STYLESHEETPATH. '/languages/genesis'); define('GENESIS\_LANGUAGES\_URL', STYLESHEETPATH. '/languages/genesis');
Define where your child theme gets the translations from
These are the translations that are specifically for your child theme and don't match any definitions in the Genesis theme itself.
The following sample is based on the "executive" theme, but that should be replaced by your own theme name.
load\_child\_theme\_textdomain('executive', apply\_filters('child\_theme\_textdomain', get\_stylesheet\_directory() . '/languages', 'executive'));
The way as it is defined above was the only way that it would except my Dutch translations from my child theme. As you can see in the definition, the language files for the child theme itself are in the root of the languages folder.
Large update of Genesis
If the translations don't match anymore and handwork is required again, just repeat the steps where you copy the files from the plugin until where you copy them back to your languages/genesis folder. You don't have to update the functions.php again.
One customer liked to have in the author profile instead of "About " (in Dutch: "Over "), just the name and no "Over". In Poedit you can't leave a string empty, for it will take the original language text (English).
If the text in the .po file is "Over" and the translation should be empty replace it with ''. It will not consume any space and it avoids that you have to do extra programming.