The problem
When you have a WordPress website and find out that there is texts that are not translated into your language, from WordPress itself, from a plugin or from the themethe solution is usually one of these 3:
- Ask the author to translate the text into your language
- Translate text programmatically
- Install a plugin like Crazy Translate Is WPML translate the text
Now, these methods each have their respective problems…
- The author is not always in the business of offering translations.
- You don’t have programming knowledge or you don’t dare to touch the code
- Translation plugins consume a lot of resources because they add much more than manual translation of texts
The easiest solution to these issues is a plugin I recently discovered on a client’s website that we maintain, and it addresses the need for translate texts into your language in a simple and light way.
The solution
The plugin is called Gettext override translations and it offers a simple interface in which to replace the original WordPress texts, themes and plugins installed on your website by the texts you want to display.
For example, you have just activated a new subject and you see that things are still to be translated…
Well, it’s as simple as browsing the plugin page in Plugins → Gettext replaces translations and start adding your text translations/substitutions.
It is important that you check the box “Protect parameter?for 2 reasons:
- Be able to revise translations later
- Translations are saved consistently
When you add your translations/substitutions, they will already appear on your website modified by your text.
restriction
Now well, the plugin is not able to translate everythingso will not translate/replace texts containing dynamic values. For example, in the screenshot I used, the theme displays 2 types of text:
- Read in full – Normal text, which does not depend on any dynamic value.
- views / comments – Dynamic text, which can change depending on the quantity (of views Is comments)
It is because of in the code of themes and plugins these texts are preceded by dynamic characters %s
Is %d
which will be replaced by an amount (views, comments, etc.) and this plugin will not translate strings with these charactersbecause one mistake could completely ruin the theme or plugin.
Thus, if the plugin detects that there is such a string in the text to be translated, for example “%d views” it will not translate views by your text, it will not touch that text/programming string.
Of course, the rest of the text strings that don’t have these dynamic characters all translate without issue, and it’s a simple and lightweight solution to a problem you’ll encounter many times when activating plugins and themes.
To replace/translate complex text strings, even dynamic onesthen you should already resort to plugins like WPML, Loco Translate or one of these guides:
(a voice, medium: 5) Rate this article to help improve the quality of the blog
YOU MAY ALSO BE INTERESTED…
Did you like this article? You can’t imagine what you’re missing on Youtube!
Source link