
If you have a blog or website spinning on WordPress and the language of the site is not English, then you have definitely encountered a localization problem.
WordPress has its own framework for translating the engine, as well as separate templates and plugins. We'll talk about this framework and convenient plug-ins in the second part.
But first, let's look at its shortcomings and how you can easily deal with them.
')
Some typical problems with system localization:
- If you use third-party plug-ins and templates, translation into Russian, as a rule, is delayed, since often this is done by other people than the developers of the code.
- Even if you translated the plug-in with your hands, but the code did not get on wordpress.org, when upgrading, the patch-transfer will need to be poured by hand again.
- Also, sometimes the resulting translation can be cut on the ears, and you would like to quickly change something without getting into the code and not compiling the translation files.
- Sometimes translators miss some phrases.
- Often you just need to localize a few phrases visible to the average user and there is no point in translating all the phrases, especially in the admin panel.
- ...
The solution to these problems through the code is quite simple. For example, in the new version of the template, you forgot to translate the word "Search ..." and you need to replace it with "Search ...".
By code this is solved like this:
add_filter ( "gettext" , "my_gettext_filter" , 1000 , 3 ); function my_gettext_filter ( $new , $old , $domain ) { if ( "Search..." == $old ) { return "..." ; } else { return $new ; } }
add_filter ( "gettext" , "my_gettext_filter" , 1000 , 3 ); function my_gettext_filter ( $new , $old , $domain ) { if ( "Search..." == $old ) { return "..." ; } else { return $new ; } }
add_filter ( "gettext" , "my_gettext_filter" , 1000 , 3 ); function my_gettext_filter ( $new , $old , $domain ) { if ( "Search..." == $old ) { return "..." ; } else { return $new ; } }
add_filter ( "gettext" , "my_gettext_filter" , 1000 , 3 ); function my_gettext_filter ( $new , $old , $domain ) { if ( "Search..." == $old ) { return "..." ; } else { return $new ; } }
add_filter ( "gettext" , "my_gettext_filter" , 1000 , 3 ); function my_gettext_filter ( $new , $old , $domain ) { if ( "Search..." == $old ) { return "..." ; } else { return $new ; } }
add_filter ( "gettext" , "my_gettext_filter" , 1000 , 3 ); function my_gettext_filter ( $new , $old , $domain ) { if ( "Search..." == $old ) { return "..." ; } else { return $new ; } }
add_filter ( "gettext" , "my_gettext_filter" , 1000 , 3 ); function my_gettext_filter ( $new , $old , $domain ) { if ( "Search..." == $old ) { return "..." ; } else { return $new ; } }
add_filter ( "gettext" , "my_gettext_filter" , 1000 , 3 ); function my_gettext_filter ( $new , $old , $domain ) { if ( "Search..." == $old ) { return "..." ; } else { return $new ; } }
But if there are several such patches, it’s inconvenient to climb each time into the code. Yes, and not necessary. Take the ready plugin
Quick Localization . It is installed simply. Download the
zip file and drop the quick-localization folder into wp-content / plugins or install the plugin directly through the admin panel.
Activate the plugin. Then we indicate which translation phrase should be replaced with our own:
We save. It seems everything.
The plugin has a lot of additional functionality. If you do not know which phrase is used and in which package (domain) of the translation, you can enable the debug search through the settings and look at the dump of all called translations.
Also in the Quick Localization plug-in, you can enable the collection of unknown translations, all, or on specified domains. The plugin will save them in drafts. You can translate the necessary, and remove the unnecessary with one click of a button.
Through the menu Export and Import, these translations can be easily transferred from site to site, as well as processed in any text editor.
The Russian translation of the plugin itself can be downloaded
here as a text
file and its contents go through the import page.
By the way, the Ukrainian news site
Siohodni, which writes on the exotic Latin standard, managed to be completely localized after adding a total of 120 entries. 87 of them for standard WordPress and 26 for the Duster template. It took less than an hour. Transferring the same transfer to another site is less than a minute.
In the second part we will talk about tools and plugins that help automate WordPress translation in a longer standard way.