简体   繁体   中英

Wordpress theme with second language

I didn't find any learn for Multi-Lingual !

1.How to use function _e() ?

2.What's text_domain ? How can i set text_domain ?

eg:

_e('Mine','text_domain')

in english returns "Mine"

in example language is "imja"

How to set "imja" ?

text_domain is a distinction inside WordPress that allows you to see which plugin or theme text comes from. The text domain can be any string that you want but as a best practice it should be a machine name of the theme or plugin you are building.

So if I had a plugin named MyPlugin I would translate text using any of the WordPress translation functions like:

print __("Translateable Text", "MyPlugin"); _e("Text that is translated then echoed", "MyPlugin");

For WordPress to render these strings in another language, in WordPress 4.0 and above, you can change the language at Settings > General > Site Language and your site will show the text in that language if available.

You will need language files for the language that you wish to change to, and if a plugin or theme doesn't offer a translation for your chosen language it will be rendered in the default language.

There are many tools and plugins for editing the .po/.mo files that hold the translations in WordPress. Some of those can be found in the WordPress translation handbook .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM