Skip to content

Latest commit

 

History

History
11 lines (11 loc) · 2.6 KB

Text-Domain-Issues.md

File metadata and controls

11 lines (11 loc) · 2.6 KB

Text Domain 相關問題

多數的 WordPress 外掛,國際化程式碼會出現的問題,多半與 Text Domain 相關。

  • This plugin's slug is correct-text-domain, but the current Text Domain is wrong-text-domain. Change the current Text Domain so it is equal to this plugin's slug, and modify the text domain in all your source files. This change is needed. Please refer to this official article.
  • This plugin's "Requires at least" is below 4.6. so you need to set a Text Domain in main-plugin-file.php, and it needs to be correct-text-domain to correctly internationalize this plugin! Please refer to this official article.
  • "Requires at least" (x.y) is below 4.6 so a load_plugin_textdomain is needed, please refer to this official article.
  • You must add your Text domain as an argument to every __(), _e() and __n() gettext call, or your translations won’t work.
  • If strings in your plugin are also used in WordPress core (e.g. ‘Settings’), you should still add your own text domain to them. Otherwise, they’ll become untranslated if the core string changes (which happens). Please refer to this official article.
  • Suppose strings in your plugin are also used in WordPress core (e.g., "Settings"), you should still add your text domain. Otherwise, they’ll become untranslated if the core string changes (which happens). Please refer to this official article.
  • If your codes have multiple placeholders in a string, please use argument swapping.
  • "Plugin name" is its plugin name, but it has a precise meaning when this string shows on the WordPress Dashboard. In some languages, like zh_TW, the translators don't translate the plugin's name but need to translate the plugin's UI strings, so I made some modifications for this issue.
  • For security reason, change <?php _e( to <?php esc_html_e(. Please refer to this official article.