Multi Language
Localizing and translating the theme
Section titled “Localizing and translating the theme”The theme’s own texts, such as button labels and headings, are default strings in the theme’s language file. All of them are in one file, naturalife.pot, in the naturalife/languages folder. You translate these strings with the free Loco Translate plugin or with the Poedit program. The step-by-step guide, including the file names WordPress expects and where to save the files, is in Translating theme strings.
Loco Translate
Section titled “Loco Translate”Loco Translate lets you translate the strings in your WordPress admin, without editing any files by hand. It is the easiest way for most sites.
Poedit
Section titled “Poedit”With Poedit, you create a translation of naturalife.pot on your computer. Name the files the way WordPress expects them (see the WordPress language naming convention), or the theme does not find your translations. Upload the .po and .mo files by FTP into wp-content/themes/naturalife/languages.
If you want to change the theme’s default English wording, you do not need to edit the theme files. Create a translation called en_US.po and en_US.mo and change the wording there.
WPML (WordPress Multilingual) is a plugin that shows the same content in several languages. With WPML you do not need a separate website for each language. You run one website and show each page, post, portfolio item or product in several languages. How to install WPML, add your languages and translate your content is explained in Translate your site with WPML or Polylang. This section covers what is specific to NaturaLife.
Changing languages
Section titled “Changing languages”Once WPML is active, visitors switch languages with the Language Menu Icon in the header. Turn the icon on or off in Appearance › Customize › Styling Options › Header Tools (see Header). Visitors see a page in the chosen language when the page exists in that language.
- If a page or post has not been translated into a language, it does not show in that language.
- The language switcher lists only the languages you have activated in WPML.
Translating a page or post
Section titled “Translating a page or post”- Create the page in your default language, with all its images and content, and publish it.
- In the list of pages or posts, click the plus icon in the column of the other language. Or open the page and use the WPML translation editor.
- Translate the content and publish the translation.
- Repeat for each language.
If you do not translate a page or post, it does not show in the other language. Visitors who switch the language on that page are sent to the home page of that language.
WPML can show untranslated posts in the default language as a fallback. NaturaLife does not support this: in WPML’s post type translation settings, choose to show only translated items for posts and the theme’s post types. For help with theme-related WPML issues, create a support ticket in your dashboard.
Categories
Section titled “Categories”NaturaLife has its own post types: Portfolio, Team and Testimonials. Like the WordPress posts, portfolio items and testimonials can be grouped into categories. To list posts by category:
- Create a post.
- Create a category.
- Assign the category to the post.
- Publish the post.
A category page lists all posts in that category, in the sort order you chose. You can add categories to a menu, so a click on the menu item shows the posts of that category. When you translate a category and its posts, each translated category page lists the translated posts in that language.
Create the categories and their translations for each language first. When you then translate a post that has a category, WPML already knows the translated category and assigns it to the translated post.
WPML String Translation
Section titled “WPML String Translation”WPML comes with an add-on called String Translation. NaturaLife registers the text fields it uses throughout the theme with WPML. Once WPML detects such a string, you translate it in String Translation, so you do not need to duplicate those fields. Read more about the add-on on wpml.org.
Not every string shows in String Translation. Only the fields that the theme registers appear in its list, for example:
- The copyright text
- The slogan
- The social media links
- The breadcrumb text
- And many more
Different widgets for each language
Section titled “Different widgets for each language”For widgets that String Translation cannot handle, WPML recommends plugins such as Widget Logic and Dynamic Widgets. They show a widget in a widget area only for a given language. The WPML documentation explains how: translating widgets.
Support for WPML
Section titled “Support for WPML”We do not give support on how the WPML plugin works. WPML has its own support forum and documentation, free and paid, and they cover the common questions about using WPML with a theme. We support only the theme’s own code.
Polylang
Section titled “Polylang”Polylang is a free alternative to WPML. Once you install it, the language menu appears in the header, the same way as with WPML: through the Language Menu Icon header tool. See the Polylang documentation and Translate your site with WPML or Polylang for the setup.
Get all RT-Themes designs, updates and support with a single Club license.
Join the Club