如何以语法正确的方式显示区域设置区域?

时间:2020-01-26 09:06:48

标签: php locale

示例代码:

var_dump(Locale::getDisplayRegion('en_US'));
var_dump(Locale::getDisplayLanguage('en_US'));

输出:

string(13) "United States"
string(7) "English"

问题:

这些都没有说“美国人”或“美国美国人”。第一个说“美国”,因为那是“地区”,第二个说“英语”,因为那是语言。我正在尝试将其粘贴到以下模板中:

You are currently viewing the __REGION__ edition.

例如:

You are currently viewing the US American edition.

或者:

You are currently viewing the American edition.

按目前的样子,它会说:

You are currently viewing the United States edition.

或者:

You are currently viewing the English edition.

这两个都是错误的。 “英语版”听起来可能是“英国”版而不是美国英语版,并且“美国版”在语法上对我而言听起来并不正确,尤其是对于其他语言(例如“德国版”或“法国版”。

请注意,所有版本都是英语,因此这不是针对不同的语言,而是针对不同的地区!

我已经经历了所有这些方法:https://www.php.net/manual/en/class.locale

可悲的是,它们似乎都不是我要找的东西。似乎这可能不存在,但我还没有放弃希望...

0 个答案:

没有答案
相关问题