From 865853da1901b307766432449443acff8cfebd57 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Sat, 26 May 2018 20:08:39 +0900 Subject: [PATCH] add some i18n support for main editor interface and Japanese message catalogue --- editor/js/main.js | 40 ++++++++++++------------ red/api/editor/locales/en-US/editor.json | 24 +++++++++++++- red/api/editor/locales/ja/editor.json | 27 ++++++++++++++-- 3 files changed, 68 insertions(+), 23 deletions(-) diff --git a/editor/js/main.js b/editor/js/main.js index e65b8f30a..80e0a692f 100644 --- a/editor/js/main.js +++ b/editor/js/main.js @@ -153,13 +153,13 @@ loadFlows(function() { var project = RED.projects.getActiveProject(); var message = { - "change-branch":"Change to local branch '"+project.git.branches.local+"'", - "merge-abort":"Git merge aborted", - "loaded":"Project '"+msg.project+"' loaded", - "updated":"Project '"+msg.project+"' updated", - "pull":"Project '"+msg.project+"' reloaded", - "revert": "Project '"+msg.project+"' reloaded", - "merge-complete":"Git merge completed" + "change-branch": RED._("notification.project.change-branch", {project: project.git.branches.local}), + "merge-abort": RED._("notification.project.merge-abort"), + "loaded": RED._("notification.project.loaded", {project: msg.project}), + "updated": RED._("notification.project.updated", {project: msg.project}), + "pull": RED._("notification.project.pull", {project: msg.project}), + "revert": RED._("notification.project.revert", {project: msg.project}), + "merge-complete": RED._("notification.project.merge-complete") }[msg.action]; RED.notify("

"+message+"

"); RED.sidebar.info.refresh() @@ -183,7 +183,7 @@ if (!!RED.projects.getActiveProject()) { options.buttons = [ { - text: "Manage project dependencies", + text: RED._("notification.label.manage-project-dep"), click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.settings.show('deps'); @@ -194,7 +194,7 @@ } else { options.buttons = [ { - text: "Close", + text: RED._("common.label.close"), click: function() { persistentNotifications[notificationId].hideNotification(); } @@ -207,7 +207,7 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: "Setup credentials", + text: RED._("notification.label.setup-cred"), click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.showCredentialsPrompt(); @@ -218,7 +218,7 @@ } else { options.buttons = [ { - text: "Close", + text: RED._("common.label.close"), click: function() { persistentNotifications[notificationId].hideNotification(); } @@ -229,7 +229,7 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: "Setup project files", + text: RED._("notification.label.setup-project"), click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.showFilesPrompt(); @@ -241,7 +241,7 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: "Create default package file", + text: RED._("notification.label.create-default-package"), click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.createDefaultPackageFile(); @@ -253,13 +253,13 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: "No thanks", + text: RED._("notification.label.no-thanks"), click: function() { persistentNotifications[notificationId].hideNotification(); } }, { - text: "Create default project files", + text: RED._("notification.label.create-default-project"), click: function() { persistentNotifications[notificationId].hideNotification(); RED.projects.createDefaultFileSet(); @@ -273,7 +273,7 @@ if (RED.user.hasPermission("projects.write")) { options.buttons = [ { - text: "Show merge conflicts", + text: RED._("notification.label.show-merge-conflicts"), click: function() { persistentNotifications[notificationId].hideNotification(); RED.sidebar.versionControl.showLocalChanges(); @@ -382,10 +382,10 @@ function loadEditor() { var menuOptions = []; if (RED.settings.theme("projects.enabled",false)) { - menuOptions.push({id:"menu-item-projects-menu",label:"Projects",options:[ - {id:"menu-item-projects-new",label:"New",disabled:false,onselect:"core:new-project"}, - {id:"menu-item-projects-open",label:"Open",disabled:false,onselect:"core:open-project"}, - {id:"menu-item-projects-settings",label:"Project Settings",disabled:false,onselect:"core:show-project-settings"} + menuOptions.push({id:"menu-item-projects-menu",label:RED._("menu.label.projects"),options:[ + {id:"menu-item-projects-new",label:RED._("menu.label.projects-new"),disabled:false,onselect:"core:new-project"}, + {id:"menu-item-projects-open",label:RED._("menu.label.projects-open"),disabled:false,onselect:"core:open-project"}, + {id:"menu-item-projects-settings",label:RED._("menu.label.projects-settings"),disabled:false,onselect:"core:show-project-settings"} ]}); } diff --git a/red/api/editor/locales/en-US/editor.json b/red/api/editor/locales/en-US/editor.json index dfcef21a6..ed7b7c2dc 100644 --- a/red/api/editor/locales/en-US/editor.json +++ b/red/api/editor/locales/en-US/editor.json @@ -67,7 +67,11 @@ "editPalette":"Manage palette", "other": "Other", "showTips": "Show tips", - "help": "Node-RED website" + "help": "Node-RED website", + "projects": "Projects", + "projects-new": "New", + "projects-open": "Open", + "projects-settings": "Project Settings" } }, "user": { @@ -108,6 +112,24 @@ "cannotAddCircularReference": "Cannot add subflow - circular reference detected", "unsupportedVersion": "

Using an unsupported version of Node.js

You should upgrade to the latest Node.js LTS release

", "failedToAppendNode": "

Failed to load '__module__'

__error__

" + }, + "project": { + "change-branch": "Change to local branch '__project__'", + "merge-abort": "Git merge aborted", + "loaded": "Project '__project__' loaded", + "updated": "Project '__project__' updated", + "pull": "Project '__project__' reloaded", + "revert": "Project '__project__' reloaded", + "merge-complete": "Git merge completed" + }, + "label": { + "manage-project-dep": "Manage project dependencies", + "setup-cred": "Setup credentials", + "setup-project": "Setup project files", + "create-default-package": "Create default package file", + "no-thanks": "No thanks", + "create-default-project": "Create default project files", + "show-merge-conflicts": "Show merge conflicts" } }, "clipboard": { diff --git a/red/api/editor/locales/ja/editor.json b/red/api/editor/locales/ja/editor.json index 999dc3422..ac17f9a75 100644 --- a/red/api/editor/locales/ja/editor.json +++ b/red/api/editor/locales/ja/editor.json @@ -67,7 +67,11 @@ "editPalette": "パレットの管理", "other": "その他", "showTips": "ヒントを表示", - "help": "Node-REDウェブサイト" + "help": "Node-REDウェブサイト", + "projects": "プロジェクト", + "projects-new": "新規", + "projects-open": "開く", + "projects-settings": "設定" } }, "user": { @@ -102,7 +106,26 @@ "lostConnectionTry": "すぐに接続", "cannotAddSubflowToItself": "サブフロー自身を追加できません", "cannotAddCircularReference": "循環参照を検出したため、サブフローを追加できません", - "unsupportedVersion": "サポートされていないバージョンのNode.jsを使用しています。
最新のNode.js LTSに更新してください。" + "unsupportedVersion": "サポートされていないバージョンのNode.jsを使用しています。
最新のNode.js LTSに更新してください。", + "failedToAppendNode": "

'__module__'がロードできませんでした。

__error__

" + }, + "project": { + "change-branch": "ローカルブランチ'__project__'に変更しました", + "merge-abort": "Gitマージを中止しました", + "loaded": "プロジェクト'__project__'をロードしました", + "updated": "プロジェクト'__project__'を更新しました", + "pull": "プロジェクト'__project__'を再ロードしました", + "revert": "プロジェクト'__project__'を再ロードしました", + "merge-complete": "Gitマージが完了しました" + }, + "label": { + "manage-project-dep": "プロジェクトの依存関係の管理", + "setup-cred": "認証情報の設定", + "setup-project": "プロジェクトファイルの設定", + "create-default-package": "デフォルトパッケージファイルの作成", + "no-thanks": "不要", + "create-default-project": "デフォルトプロジェクトファイルの作成", + "show-merge-conflicts": "マージ競合を表示" } }, "clipboard": {