[英]I18N : Constants needed in constant (Java/GWT)
我I18N申請。 它的一部分包含在菜單中。 那沒問題。
通過GWT,我可以使用Constants接口。
現在,我需要為該應用程序提供幫助,其中包括一些有關菜單的文本。
因此,在這些較大的常量中,我需要使用菜單常量。
范例:
我在I18N的屬性文件中有一個資源:
menuPlay = Play ...
現在,我想定義另一個資源=一些幫助文本:
howToPlay = In order to start the game, go to the menu ??<resource menuPlay>??
在上面的問號中,我想使用資源menuPlay。
當我想翻譯法語時,兩種資源是:
menuPlay = Jouer...
howToPlay = Pour démarrer le jeu, aller au menu ??<resource menuPlay>??
我該怎么做(在Java / GWT中)? 我的意思是,有一個現成的解決方案(我找不到或想到的)。 我不想編寫一些基於本地化信息將實時與實時結合的特定解決方案。
這將有助於防止在更改menuPlay資源時出現不一致的情況:無需費心更改其他資源howToPlay(容易忘記的高風險)。
那你的財產就像
menuPlay = Play ...
howToPlay = In order to start the game, go to the menu {0}
在使用時
為了獲得menuPlay
然后在Java中,您可以使用resource.menuPlay();
現在為了獲得howtoPlay
resource.howToPlay(resource.menuPlay());
//現在{0}
替換為Play
你可以不用參數就可以做到
howToPlay = In order to start the game, go to the menu {0} {1}
..etc
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.