From a5c00b5c81fd5c3c7f8877c602d4b2dd49458aeb Mon Sep 17 00:00:00 2001 From: YumaMatsuura <38545050+YumaMatsuura@users.noreply.github.com> Date: Fri, 25 May 2018 21:55:03 +0900 Subject: [PATCH] add translate-user-settings (#1740) --- editor/js/ui/projects/projectUserSettings.js | 44 ++++++++++---------- red/api/editor/locales/en-US/editor.json | 25 ++++++++++- red/api/editor/locales/ja/editor.json | 25 ++++++++++- 3 files changed, 70 insertions(+), 24 deletions(-) diff --git a/editor/js/ui/projects/projectUserSettings.js b/editor/js/ui/projects/projectUserSettings.js index 4c3840461..a343a07cc 100644 --- a/editor/js/ui/projects/projectUserSettings.js +++ b/editor/js/ui/projects/projectUserSettings.js @@ -24,18 +24,18 @@ RED.projects.userSettings = (function() { var currentGitSettings = RED.settings.get('git') || {}; currentGitSettings.user = currentGitSettings.user || {}; - var title = $('

').text("Committer Details").appendTo(pane); + var title = $('

').text(RED._("editor:sidebar.project.userSettings.committerDetail")).appendTo(pane); var gitconfigContainer = $('
').appendTo(pane); - $('
').appendTo(gitconfigContainer).text("Leave blank to use system default"); + $('
').appendTo(gitconfigContainer).text(RED._("editor:sidebar.project.userSettings.committer-tip")); var row = $('
').appendTo(gitconfigContainer); - $('').text('Username').appendTo(row); + $('').text(RED._("editor:sidebar.project.userSettings.userName")).appendTo(row); gitUsernameInput = $('').appendTo(row); gitUsernameInput.val(currentGitSettings.user.name||""); row = $('
').appendTo(gitconfigContainer); - $('').text('Email').appendTo(row); + $('').text(RED._("editor:sidebar.project.userSettings.email")).appendTo(row); gitEmailInput = $('').appendTo(row); gitEmailInput.val(currentGitSettings.user.email||""); } @@ -44,10 +44,10 @@ RED.projects.userSettings = (function() { function createSSHKeySection(pane) { var container = $('
').appendTo(pane); var popover; - var title = $('

').text("SSH Keys").appendTo(container); - var subtitle = $('
').appendTo(container).text("Allows you to create secure connections to remote git repositories."); + var title = $('

').text(RED._("editor:sidebar.project.userSettings.sshKeys")).appendTo(container); + var subtitle = $('
').appendTo(container).text(RED._("editor:sidebar.project.userSettings.sshKeys-tip")); - var addKeyButton = $('') + var addKeyButton = $('') .appendTo(subtitle) .click(function(evt) { addKeyButton.attr('disabled',true); @@ -72,9 +72,9 @@ RED.projects.userSettings = (function() { var validPassphrase = passphrase.length === 0 || passphrase.length >= 8; passphraseInput.toggleClass('input-error',!validPassphrase); if (!validPassphrase) { - passphraseInputSubLabel.text("Passphrase too short"); + passphraseInputSubLabel.text(RED._("editor:sidebar.project.userSettings.passphrase-short")); } else if (passphrase.length === 0) { - passphraseInputSubLabel.text("Optional"); + passphraseInputSubLabel.text(RED._("editor:sidebar.project.userSettings.optional")); } else { passphraseInputSubLabel.text(""); } @@ -91,11 +91,11 @@ RED.projects.userSettings = (function() { var row = $('
').appendTo(container); var addKeyDialog = $('
').hide().appendTo(row); - $('
').text('Add SSH Key').appendTo(addKeyDialog); + $('
').text(RED._("editor:sidebar.project.userSettings.add-sshKey")).appendTo(addKeyDialog); var addKeyDialogBody = $('
').appendTo(addKeyDialog); row = $('').appendTo(addKeyDialogBody); - $('
').appendTo(row).text("Generate a new public/private key pair"); + $('
').appendTo(row).text(RED._("editor:sidebar.project.userSettings.add-sshKey-tip")); // var bg = $('
',{class:"button-group", style:"text-align: center"}).appendTo(row); // var addLocalButton = $('').appendTo(bg); // var uploadButton = $('').appendTo(bg); @@ -125,19 +125,19 @@ RED.projects.userSettings = (function() { row = $('').appendTo(addKeyDialogBody); - $('').text('Name').appendTo(row); + $('').text(RED._("editor:sidebar.project.userSettings.name")).appendTo(row); var keyNameInputChanged = false; var keyNameInput = $('').appendTo(row).on("change keyup paste",function() { keyNameInputChanged = true; validateForm(); }); - $('').appendTo(row).find("small"); + $('').appendTo(row).find("small"); var generateKeyPane = $('
').appendTo(addKeyDialogBody); row = $('').appendTo(generateKeyPane); - $('').text('Passphrase').appendTo(row); + $('').text(RED._("editor:sidebar.project.userSettings.passphrase")).appendTo(row); var passphraseInput = $('').appendTo(row).on("change keyup paste",validateForm); - var passphraseInputSubLabel = $('').appendTo(row).find("small"); + var passphraseInputSubLabel = $('').appendTo(row).find("small"); // var addLocalKeyPane = $('
').hide().appendTo(addKeyDialogBody); // row = $('').appendTo(addLocalKeyPane); @@ -179,13 +179,13 @@ RED.projects.userSettings = (function() { } } var formButtons = $('').appendTo(addKeyDialog); - $('') + $('') .appendTo(formButtons) .click(function(evt) { evt.preventDefault(); hideEditForm(); }); - var saveButton = $('') + var saveButton = $('') .appendTo(formButtons) .click(function(evt) { evt.preventDefault(); @@ -264,7 +264,7 @@ RED.projects.userSettings = (function() { utils.sendRequest(options); var formButtons = $('').appendTo(row); - $('') + $('') .appendTo(formButtons) .click(function(evt) { try { @@ -289,7 +289,7 @@ RED.projects.userSettings = (function() { var container = $('
').appendTo(row); if (entry.empty) { container.addClass('red-ui-search-empty'); - container.text("No SSH keys"); + container.text(RED._("editor:sidebar.project.userSettings.no-sshKeys")); return; } var topRow = $('
').appendTo(container); @@ -313,7 +313,7 @@ RED.projects.userSettings = (function() { .click(function(e) { e.stopPropagation(); var spinner = utils.addSpinnerOverlay(row).addClass('projects-dialog-spinner-contain'); - var notification = RED.notify("Are you sure you want to delete the SSH key '"+entry.name+"'? This cannot be undone.", { + var notification = RED.notify(RED._("editor:sidebar.project.userSettings.deleteConfirm", {name:entry.name}), { type: 'warning', modal: true, fixed: true, @@ -326,7 +326,7 @@ RED.projects.userSettings = (function() { } }, { - text: "Delete key", + text: RED._("editor:sidebar.project.userSettings.delete"), click: function() { notification.close(); var url = "settings/user/keys/"+entry.name; @@ -400,7 +400,7 @@ RED.projects.userSettings = (function() { utils = _utils; RED.userSettings.add({ id:'gitconfig', - title: "Git config", // TODO: nls + title: RED._("editor:sidebar.project.userSettings.git-config"), // TODO: nls get: createSettingsPane, close: function() { var currentGitSettings = RED.settings.get('git') || {}; diff --git a/red/api/editor/locales/en-US/editor.json b/red/api/editor/locales/en-US/editor.json index d827ba092..dfcef21a6 100644 --- a/red/api/editor/locales/en-US/editor.json +++ b/red/api/editor/locales/en-US/editor.json @@ -434,7 +434,30 @@ "dependencies": "Dependencies", "settings": "Settings", "editDescription": "Edit project description", - "editDependencies": "Edit project dependencies" + "editDependencies": "Edit project dependencies", + "userSettings": { + "committerDetail": "Committer Details", + "committer-tip": "Leave blank to use system default", + "userName": "Username", + "email": "Email", + "sshKeys": "SSH Keys", + "sshKeys-tip": "Allows you to create secure connections to remote git repositories.", + "add": "add key", + "add-sshKey": "Add SSH Key", + "add-sshKey-tip": "Generate a new public/private key pair", + "name": "Name", + "nameRule": "Must contain only A-Z 0-9 _ -", + "passphrase": "Passphrase", + "passphrase-short": "Passphrase too short", + "optional": "Optional", + "cancel": "Cancel", + "generate": "Generate key", + "no-sshKeys": "No SSH keys", + "copy-publicKey": "Copy public key to clipboard", + "delete": "Delete key", + "git-config": "Git config", + "deleteConfirm": "Are you sure you want to delete the SSH key __name__? This cannot be undone." + } } }, "typedInput": { diff --git a/red/api/editor/locales/ja/editor.json b/red/api/editor/locales/ja/editor.json index 68e4fc517..999dc3422 100644 --- a/red/api/editor/locales/ja/editor.json +++ b/red/api/editor/locales/ja/editor.json @@ -424,7 +424,30 @@ "dependencies": "依存関係", "settings": "設定", "editDescription": "プロジェクトの詳細を編集", - "editDependencies": "プロジェクトの依存関係を編集" + "editDependencies": "プロジェクトの依存関係を編集", + "userSettings": { + "committerDetail": "コミッター詳細", + "committer-tip": "システムのデフォルトを使用する場合、空白のままにしてください", + "userName": "ユーザ名", + "email": "メールアドレス", + "sshKeys": "SSH キー", + "sshKeys-tip": "gitリポジトリへのセキュアな接続を作成できます。", + "add": "キーを追加", + "add-sshKey": "SSHキーを追加", + "add-sshKey-tip": "新しい公開鍵/秘密鍵ペアを生成します", + "name": "名前", + "nameRule": "A-Z 0-9 _ - のみを含む", + "passphrase": "パスフレーズ", + "passphrase-short": "パスフレーズが短すぎます", + "optional": "任意", + "cancel": "中止", + "generate": "キーを生成", + "no-sshKeys": "SSHキーがありません", + "copy-publicKey": "公開鍵をクリップボードにコピー", + "delete": "キーを削除", + "git-config": "Git設定", + "deleteConfirm": "SSHキー __name__ を削除してもよいですか? 削除したSSHキーを元に戻すことはできません。" + } } }, "typedInput": {