Translation & RTL
Translation
1. Make a new translation from Parent theme
Madara is a WMPL-compatible and multi-language-ready theme. To translate this theme:
- Download and install this tool POEdit
- Open POEdit and load [/madara/languages/madara.po]
- Translate the text and save the file
- A file named madara.mo is created. Save it in /madara/languages/ folder. Rename it with Code Name of your language. For example, de_DE.mo for German – Deutsche. See language code list here http://codex.wordpress.org/WordPress_in_Your_Language
- For WordPress 4.0 and above, go to Settings > General and choose Site Language
2. Translate from Child theme.
Translating theme from child theme help you keep the translated language file when updating theme. So you can feel free to update theme without losing the translation.
- Copy the language folder from themes\madara to themes\madara-child
- Make a new translation follow the above steps.
- Copy this code to themes\madara-child\functions.php, in which ‘madara‘ is the text domain of madara theme
/* Loads the child theme textdomain. */ function wpdocs_child_theme_setup() {
load_child_theme_textdomain( 'madara', get_stylesheet_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'wpdocs_child_theme_setup' );
- Save the functions.php file.
- For WordPress 4.0 and above, go to Settings > General and choose Site Language
3. Update an Older Translation
- Copy your existing Custom Language folder from your current theme version to the updated version’s Language folder.
- Open your old existing .pot file in Poedit
- Choose Catalog > Update from POT file from the menu and select your new madara.pot file
- The catalog will then be auto updated with all the new text strings, and your custom ones will be preserved.
- Save your updated .pot file
RTL
Madara also supports RTL – Right To Left languages. The remarkable is that if your WordPress language (in Settings> General > Site Language) is an RTL language, the theme will recognize it and turns theme’s direction to RTL automatically. So you don’t need to change an option.