ローカリゼーション リソース バンドルから文字列をオートコンプリート (CTRL+SPACE) できる Eclipse 用のプラグインはありますか?
または、簡単にローカライズするための他の良い方法はありますか?
私の現在のステータス。動作していますが、もっと簡単な方法があると思います。
これは私のローカリゼーション クラスです:
/**
* Singelton class to provide localization Strings
*
* @author Andreas Freitag
*
*/
public class Localization {
private static Localization instance = null;
private Options options;
private ResourceBundle captions;
private Localization() {
options = Options.getInstance();
Locale locale = new Locale(options.getLanguage());
Locale.setDefault(new Locale(options.getLanguage()));
captions = ResourceBundle.getBundle("res.localization.localizationMessages", locale);
}
/**
* Getter for the singelton localization (thread-safe)
* */
public synchronized static Localization getInstance() {
if (instance == null) {
synchronized (Localization.class) {
instance = new Localization();
}
}
return instance;
}
/**
* A little convenience for getting the Localized strings
*
* @param name
* of the element to search for
* @return the localized String
*/
public String getString(String name) {
return captions.getString(name);
}
}
アクセスするローカライズされた文字列Localization.getInstance.getString("Infoframe.Example");