You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WordPress中__()、_e、_ex()等函数的正式名称是什么?

WordPress 翻译函数的正式名称解析

Hey there! Let's break down the official names and core roles of these WordPress functions, which are all part of the platform's internationalization (i18n) and localization (l10n) toolkit:

  • __(): Its official name is "Retrieve Translated String". This function fetches the translated version of a string but doesn't output it directly—you'll need to use something like echo to display it. For example: echo __('Welcome to our site', 'my-theme-domain');
  • _e(): Goes by the official name "Display Translated String". Unlike __(), this one outputs the translated string immediately, so you don't need an extra echo. Usage example: _e('Welcome to our site', 'my-theme-domain');
  • _ex(): Officially called "Retrieve Translated String with Context". This is super useful when a single word has different meanings depending on context. You pass an extra context parameter to clarify, like: _ex('Post', 'as a verb (e.g., post a comment)', 'my-plugin-domain'); vs _ex('Post', 'as a noun (e.g., a blog post)', 'my-plugin-domain');—this helps translators pick the right translation for each scenario.

All these functions exist to make WordPress themes and plugins easy to localize for different languages and regions.


内容的提问来源于stack exchange,提问作者user9176383

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:17:17