2014-09-04 149 views
0

我的目標是演唱會就像在瑞士CH'的代碼,我想把它轉換成在用戶瀏覽器的語言環境的語言轉換ISO2國家代碼

我試圖使用由Grails的提供國標籤:

<g:country code="che"/> 

但它似乎只適用於IOS3代碼。

任何人都可以幫到我嗎?

感謝您的建議。

回答

0

您可以使用自己的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