What is the use of wpml-config.xml if you have String Translation?

What is File wpml-config.xml

Usage in WPML? Especially if I have translation management and adding string translation? With them I just browse my theme, the plugin finds all translatable strings and I can just translate them. And when translating, I duplicate pages, etc.

So what exactly is the purpose of this .xml file? I'm a little puzzled: \

EDUCATIONAL EDITING

After working with wpml a little more, I also found out that if you create, say, copyright text to appear in the footer in your customizer, then the only way to translate that text with wpml is to use wpml-config.xml

. So basically for any text input field in your theme, you need to tell wpml that it can be translatable text. And you will do this:

<wpml-config>
    <admin-texts>
        <key name="blogname" />
        <key name="blogdescription" />
        <key name="theme_mods_language_textdomain">
            <key name="copyright" />
        </key>
    </admin-texts>
</wpml-config>

      

If you need to specify the language textdomain (or the name of the theme, not 100% sure about it yet). Internally, you configure the name of the settings that the input field ( 'type' => 'text'

) has.

I understand it can be done with exchange expressions that output something in the interface, but you need a different tag in .xml

.

+3


source to share


1 answer


Here is my little detail, let's say you created a custom plugin and combined it with wpml !, so you created inorder po files to translate the tags and this is something like below and it will work accordingly,

<?php _e('Hi Fresher','your_text_domain');?> 

      

but if you tried to do the same as

<?php _e(get_option('testmyname','your_text_domain'));?> //testmyname contain Hi Fresher

      

Does regular translation work? and you cannot make it wpml compatible. To solve this problem, wpml already provides an xml file to do the translation.

In this case, you can just use it like you need to enter some more information in the wpml-config.xml file, it should be placed in the root folder of whatever (theme / plugins folder). create a wpml-config.xml file and do this

<wpml-config>
    <admin-texts>
        <key name="blogname" />
    </admin-texts>
</wpml-config>

      



the above code is in the wpml-config.xml file and should be placed in the root folder of your theme, I tried myself for testing, here is the result,

The screenshot is for translation, after being translated and released into French

Before translation and the wpml-config.xml file specified in the wpml string translation Before Translation

After translating your custom text After Translation

Example output I changed to French based on the dropdown Sample Output

Hope this helps :)

Thank.

+2


source







All Articles