• R/O
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

OmegaT のメニューバーにフォルダーツリー参照用のメニューを追加します。


コミットメタ情報

リビジョン64 (tree)
日時2014-05-12 11:51:29
作者yu-tang

ログメッセージ

Change L10n's key to enum

変更サマリ

差分

--- trunk/src/jp/sourceforge/users/yutang/omegat/plugin/foldermenu/MenuManager.java (revision 63)
+++ trunk/src/jp/sourceforge/users/yutang/omegat/plugin/foldermenu/MenuManager.java (revision 64)
@@ -39,13 +39,13 @@
3939 private ShellLinkMenuItem currentTargetFile;
4040
4141 public MenuManager() {
42- root = createLocalizedMenu(L10n.getFoldersMenuLabel()); // Folders menu
42+ root = createLocalizedMenu(L10n.get(L10n.Key.FOLDERS_MENU_LABEL)); // Folders menu
4343 root.addMenuKeyListener(MenuHelper.getMenuKeyListener()); // for opening folder with enter key
4444 root.addMenuListener(MenuHelper.getRootMenuListener());
4545
4646 // ProjectRoot
4747 try {
48- currentProject = new ShellLinkMenu(L10n.getProjectRootMenuLabel());
48+ currentProject = new ShellLinkMenu(L10n.get(L10n.Key.PROJECT_ROOT_MENU_LABEL));
4949 root.add(currentProject.getMenu());
5050 } catch (IOException ex) {
5151 Log.log(ex);
@@ -55,7 +55,7 @@
5555 // User Config
5656 try {
5757 File confDir = new File(StaticUtils.getConfigDir());
58- root.add(new ShellLinkMenu(confDir, L10n.getUserConfigMenuLabel()).getMenu());
58+ root.add(new ShellLinkMenu(confDir, L10n.get(L10n.Key.USER_CONFIG_MENU_LABEL)).getMenu());
5959 } catch (IOException ex) {
6060 Log.log(ex);
6161 }
@@ -64,11 +64,11 @@
6464 root.add(new JSeparator());
6565
6666 // Current Source File
67- currentSourceFile = new ShellLinkMenuItem(L10n.getSourceDocumentMenuLabel());
67+ currentSourceFile = new ShellLinkMenuItem(L10n.get(L10n.Key.SOURCE_DOC_MENU_LABEL));
6868 root.add(currentSourceFile.getMenuItem());
6969
7070 // Current Target File
71- currentTargetFile = new ShellLinkMenuItem(L10n.getTargetDocumentMenuLabel());
71+ currentTargetFile = new ShellLinkMenuItem(L10n.get(L10n.Key.TARGET_DOC_MENU_LABEL));
7272 root.add(currentTargetFile.getMenuItem());
7373
7474 // insert Files menu before the last menu (Help menu.)
--- trunk/src/jp/sourceforge/users/yutang/omegat/plugin/foldermenu/filepreview/WordPreview.java (revision 63)
+++ trunk/src/jp/sourceforge/users/yutang/omegat/plugin/foldermenu/filepreview/WordPreview.java (revision 64)
@@ -53,7 +53,7 @@
5353 this.originalFileLastModified = originalFile.lastModified();
5454 this.temporaryFile = getTempFile(originalFile);
5555 this.windowTitle = StaticUtils.format(
56- L10n.getWordWindowCaption(),
56+ L10n.get(L10n.Key.WORD_WINDOW_CAPTION),
5757 originalFile.getName());
5858 this.temporaryFile2 = getTempFile2(this.temporaryFile);
5959 }
--- trunk/src/jp/sourceforge/users/yutang/omegat/plugin/foldermenu/MenuHelper.java (revision 63)
+++ trunk/src/jp/sourceforge/users/yutang/omegat/plugin/foldermenu/MenuHelper.java (revision 64)
@@ -286,7 +286,7 @@
286286 } catch (IOException ex) {
287287 Log.log(ex);
288288 Core.getMainWindow().showMessageDialog(StaticUtils.format(
289- L10n.getErrMsgFileHasNoAssoc(), path));
289+ L10n.get(L10n.Key.ERROR_FILE_HAS_NO_ASSOC), path));
290290 }
291291 }
292292
--- trunk/src/jp/sourceforge/users/yutang/omegat/plugin/foldermenu/L10n.java (revision 63)
+++ trunk/src/jp/sourceforge/users/yutang/omegat/plugin/foldermenu/L10n.java (revision 64)
@@ -19,49 +19,36 @@
1919 import java.util.ResourceBundle;
2020
2121 /**
22- *
22+ * Manage localization.
23+ *
2324 * @author Yu Tang
2425 */
2526 public class L10n {
2627
28+ public enum Key {
29+ // for menu
30+ FOLDERS_MENU_LABEL,
31+ PROJECT_ROOT_MENU_LABEL,
32+ ROOT_MENU_LABEL,
33+ USER_CONFIG_MENU_LABEL,
34+ SOURCE_DOC_MENU_LABEL,
35+ TARGET_DOC_MENU_LABEL,
36+
37+ // for Word
38+ WORD_WINDOW_CAPTION,
39+
40+ // for error
41+ ERROR_FILE_HAS_NO_ASSOC
42+ }
43+
2744 private static final ResourceBundle bundle;
2845
2946 static {
3047 bundle = ResourceBundle.getBundle(L10n.class.getPackage().getName() + ".Bundle");
3148 }
32-
33- // for menu
3449
35- public static String getFoldersMenuLabel() {
36- return bundle.getString("FOLDERS_MENU_LABEL");
50+ public static String get(Key key) {
51+ return bundle.getString(key.name());
3752 }
38-
39- public static String getProjectRootMenuLabel() {
40- return bundle.getString("PROJECT_ROOT_MENU_LABEL");
41- }
42-
43- public static String getUserConfigMenuLabel() {
44- return bundle.getString("USER_CONFIG_MENU_LABEL");
45- }
4653
47- public static String getSourceDocumentMenuLabel() {
48- return bundle.getString("SOURCE_DOC_MENU_LABEL");
49- }
50-
51- public static String getTargetDocumentMenuLabel() {
52- return bundle.getString("TARGET_DOC_MENU_LABEL");
53- }
54-
55- // for Word
56-
57- public static String getWordWindowCaption() {
58- return bundle.getString("WORD_WINDOW_CAPTION");
59- }
60-
61- // for error
62-
63- public static String getErrMsgFileHasNoAssoc() {
64- return bundle.getString("ERROR_FILE_HAS_NO_ASSOC");
65- }
66-
6754 }