LWUIT Resource editor를 사용하여 프로젝트의 res-file에 지역화 테이블을 만들었습니다. 그러나 다른 지역화를 전환하는 방법을 모르겠습니다. 내 프로그램을위한 글로벌 언어를 어떻게 설정합니까?LWUIT를 사용하는 j2me 프로그램에서 현지화를 어떻게 변경합니까?
1
A
답변
2
예를 찾을 수 있습니다. (번들 및 병합 기본 저장 새 로컬 리 제이션 병합 L10N (이 객체는 hashTable 임)
if (themeName != null && !themeName.equals(this.currThemeName)) {
try {
if (themeName.equals(DEFAULT_THEME_NAME)) {
defaultTheme = Resources.open(DEFAULT_THEME_NAME);
bundle = null;
} else {
defaultTheme = Resources.open(DEFAULT_THEME_NAME);
bundle = Resources.open(themeName);
}
mergeL10N = defaultTheme.getL10N("Localization (L10N) 1", "iw");
if (bundle != null) {
mergeHashtable(mergeL10N, bundle.getL10N("Localization (L10N) 1", "iw"));
}
UIManager.getInstance().setResourceBundle(mergeL10N);
}
} catch (Exception e) {
e.printStackTrace();
}
}
1
당신은 당신의 입술을 열고 사용하려는 테이블을 사용해야합니다, 여기 당신이 코드는 하나에 두 개의 diffrent 지역화를 병합 할 수 있습니다
try {
Constants.res = Resources.open("/Lang.res");
} catch (Exception e){
System.err.println("can't load resource file:" + e);
}
Hashtable h = Constants.res.getL10N("English.res","en");