Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Grails 转换ISO2国家代码_Grails_Converter_Iso_Country - Fatal编程技术网

Grails 转换ISO2国家代码

Grails 转换ISO2国家代码,grails,converter,iso,country,Grails,Converter,Iso,Country,我的目标是在瑞士协调类似“CH”的代码,我想将其转换为用户浏览器所在地区的语言 我尝试使用grails提供的country标记: <g:country code="che"/> 但它似乎只适用于IOS3代码 有人能帮我吗 谢谢您的建议。您可以自己使用java.util.Locale实例 def l = new Locale('de', 'CH') l.displayCountry // will display `Switzerland` on a computer with En

我的目标是在瑞士协调类似“CH”的代码,我想将其转换为用户浏览器所在地区的语言

我尝试使用grails提供的country标记:

<g:country code="che"/>
但它似乎只适用于IOS3代码

有人能帮我吗

谢谢您的建议。

您可以自己使用java.util.Locale实例

def l = new Locale('de', 'CH')
l.displayCountry // will display `Switzerland` on a computer with English locale
l.getDisplayCountry(l)  // will display `Schweiz`
l.getDisplayCountry(request.locale) // the answer to your question