2009-09-12 19:05
浏览 38


When you call the gettext php function for translating text to another language, it uses the text you have on the page to act as the KEY/ID to lookup the value to replace it with

echo gettext('hello how are you today');

that would be the text used to lookup the translation, however I would like to use something like this

echo gettext('welcome_message');

and have that translated into English and any other language I offer. So how could I make this happen? How can I make gettext function ALWAYS use a language file? So if my default language is English for the site then instead of gettext showing welcome_message to an English user it would show hello how are you today

Is it as simple as just creating an English language file in addition to the other language files?

图片转代码服务由CSDN问答提供 功能建议

当你调用gettext php函数将文本翻译成另一种语言时,它会使用你在页面上的文字来 充当KEY / ID来查找值以替换它

  echo gettext('你好今天好吗'); 


  echo gettext('welcome_message'); \  n   

并将其翻译成英语和我提供的任何其他语言。 那怎么能让这件事发生呢? 如何使gettext函数始终使用语言文件? 因此,如果我的默认语言是网站的英语,那么它将显示你好,今天你好吗


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题