Menu Close

Polylang Strings translations Add custom string translation

Polylang is a powerful wordpress multilingual site plug-in, second to WPML, thanks to its free-to-use advantage. However, there are few Korean language information articles related to the problem because there are few users of the local multilingual site. Even the most famous WPML among the multilingual plug-ins can be regarded as having no Polylang because there is little information in Korean web search results.

So I hope that GKKmon is using the Polylang plug-in and that I have seen the traces of my first experience in the world of polygamy, so I hope that somebody will be able to use it with ease and will be able to use Polylang and linked Lingotek I will write down.

    Polylang Strings translations

One of the key features of Polylang is Strings translations. It is literally a string translation system. It is a function to translate the object characters of the site easily, such as the title of the site, the description included in the tag line, the plug-in, comment, This feature is necessary to show the site title and so on to the people who access each language, and it is a necessary function to make a complete multi-language site.

The problem is that the number of strings that polylang recognizes is itself limited. Site titles, tag lines, and jetpack related characters, as well as other really essential words, can be changed in this menu, but there are certain parts that are not directly customized or are not recognized in the theme, Recognizing and translating through the Strings translations menu requires additional processing.

    Using the "Polylang Theme Strings" plugin

The first is to use the 'Polylang Theme Strings' plugin. Like the plugin name, it converts almost any string element present in the theme into Polylang, making it customizable from the Strings translations menu. Using this plugin is very convenient because almost all elements are recognized.

In this case, however, there are parts that can not be directly recognized or customized. In this case, you have to modify it directly using the code provided by Polylang.

    Add custom characters to Strings translations with direct code modifications

GKKmon also modified the code directly, not the plugin, but first we need to express the string in php and then link the php to the polylang in function.php. For example, if you want to add a specific phrase to your main page (index.php) to a string translation, you can create PHP like this in "index.php"

<?php pll_e('Hello'); ?>

Then add the following code from functions.php to the string "Hello" and link it with polylang.

add_action('init', function() {
  pll_register_string('custom', 'Hello');
});

You can use this code to add custom strings to Polylang's Strings translations menu, no matter how many. However, it is troublesome to display all the strings to be translated in the same manner as above.

Comment (Information not required)

Posted in All, Wordpress, Information

이메일 구독 - Email Subs

최선을 다해 직접 만든 콘텐츠만 공유합니다.
We share the best content we have created.