Woocommerce Multilingual issue, How to add and edit string.

巧了我就是萌 提交于 2019-12-13 05:52:36

问题


I am working on an multilingual e-Shop using Woocommerce. I downloaded the woocommerce .po and .mo, they work fine.

However, I added some custom content into some .php files. And there are some string that I want to translate.

E.g. I found the code in "templates/content-product.php" and the code is at line 64:

I get into the .po file. And added:

#: templates/content-product.php:64 msgid "View Product" msgstr "查看產品"

But it doesn't work. How to check the exact line of code to make it works?


回答1:


You should copy template files into your theme's WooCommerce folder. And then if you modify strings, use the gettext() functions with a custom text domain.

For example:

_e( 'Some sample text', 'my-text-domain' );

Then you will be able to generate mo/po files for the 'my-text-domain'.

Developer's Handbook on internationalizing plugins
Codex: i18n for WordPress Developers



来源:https://stackoverflow.com/questions/28250930/woocommerce-multilingual-issue-how-to-add-and-edit-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!