Translation

How to translate strings to your own language

As of May 2020, Enfold already has translations for following languages included:

  • Arabic
  • Catalan
  • Chinese (Simplified)
  • Chinese (Taiwan)
  • Czech
  • Danish
  • Dutch
  • French
  • German
  • German (Switzerland)
  • German (Formal)
  • Greek
  • Hebrew
  • Hungarian
  • Italian
  • Japanese
  • Korean
  • Norwegian
  • Persian
  • Polish
  • Portuguese (Brazil)
  • Romanian
  • Russian
  • Slovak
  • Spanish
  • Swedish
  • Turkish

Translations are contributed by fellow Enfold users and some of them are not 100% complete. That is because we  add new strings with almost each update and users who contributed translations only needed to translate the strings on front-end. If you would like to contribute translations, you can download latest versions of language files here and then post them in this thread. If you have a GitHub account or do not mind creating one, you can make pull requests. Instructions can be found here.

Thanks a lot to all contributors! We and whole Enfold community appreciate your effort 🙂

If you would like to translate untranslated strings or update existing strings, you can use Loco Translate plugin or Poedit software.

With Loco Translate, you can edit strings from WordPress dashboard.

After installing the plugin, please go to Loco Translate -> Themes -> Enfold -> Advanced configuration tab and insert  “lang/enfold.pot” in “Template file” field.

Then, please go to Loco Translate -> Settings -> Site Options -> Extracting strings and insert “99999K” in “Skip PHP files larger than:” field.

It is important to sync files before updating to make sure all available strings are ready for translation. To sync files in Loco Translate, please go to Loco Translate -> Themes -> Enfold -> Overview tab -> Edit Template tab, click Sync button and Save. Then go to Loco Translate -> Themes -> Enfold -> Overview tab, choose your language, click Sync button and Save.

After syncing files, you are ready to update language files 🙂

You can find language files inside /wp-content/themes/enfold/lang/ folder and edit .po files using Poedit.

Before translating your strings, please make sure to click “Update” button and save.

After updating the strings, you can replace new file with the old one located in /wp-content/themes/enfold/lang/ folder.

How to translate pages built with Enfold using WPML

Enfold is fully compatible with WPML and you can use WPML to turn your site into a multilingual one in minutes.

You can check out video tutorial below or head over to WPML documentation for more in depth instructions and start translating your site right away!

The tutorial video shows an easy way to translate pages directly from the WPML interface. As an alternative you of course always have the option to create a second page with WordPress and set it as a translation to the first page. This allows more flexibility and you can provide different layout structures for a translation, but lacks the convenience that when you edit the  layout on one page that it also changes on all translations. It’s entirely your choice to decide which method you prefer 😉

New WPML feature, Display as translated

WPML introduces a new translation mode called – display as translated – which is compatible with Enfold and invaluable for developers using Enfold demos.

About the display as translated feature:

  • Users can show original content if no translation is available.
  • Users can display untranslated content without the need to duplicate it anymore.
  • Useful for sites that don’t need to translate everything: listing, directory and membership sites as well as WooCommerce products and taxonomies.

Example:

Let’s say we have a real estate site and we don’t want to translate all the post types belonging to “properties”.

Thanks to this new mode, we can have 98% of our page translated to Spanish but still containing some content in English without duplicating it:

To sum up:

  • If the translation exists = it will display the translation.
  • If the translation does not exist = it will display the post in the site default language.

How to enable this new translation mode for the post types of your choice:

  1. Go to WPML > Translation Management > Multilingual Content Setup
  2. Scroll down to Post Types Translation
  3. Select “Translatable – use translation if available or fallback to original language” option for the post types of your choice.

Child Theme Translations

In case you want to modify something in an Enfold translation you can do it by directly editing the translation file. However, if you update the theme these modifications will be lost. To avoid this, it is recommended to use a child theme approach, here’s how to do it.

Step 1

Create a /lang/ folder in your child theme directory and copy (from the parent theme) the translation files to be modified:

Step 2

Add the following to your child theme functions.php file:

function overwrite_language_file_child_theme() {
    $lang = get_stylesheet_directory().'/lang';
    return $lang;
}
add_filter('ava_theme_textdomain_path', 'overwrite_language_file_child_theme');

Now the translations found in your child theme /lang/ folder will be loaded instead.

Translating the portfolio slug with WPML

Since Enfold 2.4.4 we use the _x() function to translate the portfolio post type slugs. It’s the default (and recommended) solution to translate post type slugs with WPML. Please note that you must install the String Translation extension first – otherwise you can’t translate the slug(s).

After you installed both plugins and Enfold go to the WordPress Dashboard (admin screen) and select “WPML” > “Translation options” from the sidebar menu. A new option page will load – search for the “Translate custom posts slugs (via WPML String Translation).” checkbox and tick it (=activate this setting). Then click the blue “Save” button.

Afterwards search for the “Custom post types” option field on the same option page. It will look like:

Note that you need to tick the checkbox below “Portfolio Items” – otherwise you won’t see the slug translation options for the post type. WPML enables you to translate the slug for each registered language except the standard language. Enter your custom text/translation into the text field(s) and then save the settings.

Eventually select “Settings” > “Permalinks” from the sidebar menu. You’ll notice a “Portfolio Entry Settings” section near the bottom of the permalink option page which enables you to change the slug for the standard language. By default the “Portfolio Items Base” option is set to “portfolio-item” and the “Portfolio Categories Base” is set to “portfolio_entries”. You can replace the default values with some custom text – however you must not use special characters or spaces.

Last but not least save the permalink settings by clicking the “Save Changes” button. Please save the permalink settings even if you didn’t change the default slug rules because the saving process forces WordPress to clear/flush the slug rewrites rules.