问题
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