Translating Rey theme and Core plugin

You are here:
Estimated reading time: 1 min

Using translation plugins (like Loco Translate)

I generally recommend using Loco Translate with its addon Automatic Translate to automatically translate string (over 80% translations are ok, while 20% may require manual corrections).

Rey theme is mostly a skeleton, while Rey Core actually extends it with features. So most text strings will be located in Rey Core plugin.

Make sure to scan for text strings in:

  • WooCommerce
  • Rey Core plugin (everything WooCommerce related)
  • Rey Theme (generic blogging strings)

Here’s a quick video of Loco Translate in action .

Troubleshoot: translations are overwritten/lost on updates

Make sure to check where the translation files are saved to avoid them being overwritten by updates. More here . Basically “Custom” is the recommended choice.

Troubleshoot: some text strings don’t show up after searching

This might be happening because the text string you searched for is added after the last translation process, meaning that the language files are not updated in Loco Translate. Simply try to click on the Sync button eg: and retry searching afterwards.

Using multilanguage plugins

Rey supports multiple translation plugins such as Polylang, WPML, Gtranslate or QTranslateX (deprecated). If you install any of these plugins, you should be able to find a new “Language switcher” element added to the elements tray in Elementor editor.

Using code snippets

For some reason if you want to use plain code to change texts, here’s how you can do it:

add_filter('gettext', function ($translation, $text, $domain) {
	if( $domain === 'rey-core' ){
		$translation = str_replace('Some Text', 'Translated text', $translation);
	return $translation;
}, 10, 3);

Some texts are registered with a context, therefore this code is more appropiate.

add_filter('gettext_with_context', function ($translation, $text, $context, $domain) {
	if( $domain === 'rey-core' ){
		$translation = str_replace('Some Text', 'Translated text', $translation);
	return $translation;
}, 10, 4);

In both examples you can see i’m limiting to “rey-core” text strings only. You can also use “rey” if a text comes from the theme.

Was this article helpful?
Dislike 3
Views: 4318

3 Replies to “Translating Rey theme and Core plugin”

  1. Julien Deret

    The auto translate plugin is dead .The free IBM api doesn’t work and the Yandex API isn’t free anymore. Any alternative ?

    1. Julien Deret

      No need to publish. They published today a fix for that.

      1. mariushoria[ Post Author ]

        Hey Julien,

        Not sure what you meant with “free IBM api”. To be honest i’m also interested in an alternative solution to Yandex API which isn’t free anymore. I had noted to find automatic translation solutions too. Thanks!

Comments are closed.