Translating Rey theme and Core plugin

You are here:
Estimated reading time: 1 min

Using translation plugins

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).

If you don’t find a string after scanning, please make sure to scan Rey Core plugin. To recap, Rey theme is mostly a skeleton, while Rey Core actually extends it with features.

Using multilanguage plugins

Rey supports multiple translation plugins such as Polylang, WPML 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 0
Views: 926

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!

Join the conversation