使用语言环境标识符找到语言的方向?

使用语言环境标识符找到语言的方向?

问题描述:

ICU(php Intl扩展)是否提供一种检测语言方向(rtl/ltr)的方法?

Does ICU (php Intl extension) provides a way to detect the direction of a language (rtl/ltr) ?

方向是脚本数据.一种语言可以使用许多脚本,而一种脚本可以被多种语言使用,所以我不确定您可以将一种语言映射到一个方向.

Direction is a script data. A language can use many scripts and a script can be used by many languages, so I'm not sure you can map a language to a direction.

即使可以,PHP也无法提供获取这些信息的方法.但是,您可以尝试 icanboogie/cldr 来查看CLDR数据是否会有用(毕竟,大多数语言仅使用一个脚本).

Even if you could, PHP provides no way to get these informations. However you can try icanboogie/cldr to see if CLDR data would be of any use (after all most languages use only one script).

您可以在此处找到语言和脚本和此处编写包含方向的数据.

You can find here a mapping between languages and scripts and here scripts data which include direction.