From 6375a865b326fd9c5c676efa680bcb1169bba0ce Mon Sep 17 00:00:00 2001 From: n313893254 Date: Thu, 17 May 2018 16:45:30 +0800 Subject: [PATCH] export text to tranlation file --- .../pipeline-step-form/component.js | 27 +++++++++++-------- .../pipeline-step-form/template.hbs | 2 +- .../pipeline-step-task/template.hbs | 12 ++++----- .../components/pipeline-trigger/template.hbs | 8 +++--- .../addon/components/step-scm/template.hbs | 12 ++++----- lib/pipeline/addon/import/template.hbs | 4 +-- lib/pipeline/addon/new-pipeline/template.hbs | 8 +++--- .../addon/utils/branchConditionsEnums.js | 10 +++---- lib/pipeline/translations/en-us.yaml | 21 +++++++++++++-- lib/pipeline/translations/zh-hans.yaml | 20 ++++++++++++-- 10 files changed, 82 insertions(+), 42 deletions(-) diff --git a/lib/pipeline/addon/components/pipeline-step-form/component.js b/lib/pipeline/addon/components/pipeline-step-form/component.js index e8b5c2fde..0d1a73bff 100644 --- a/lib/pipeline/addon/components/pipeline-step-form/component.js +++ b/lib/pipeline/addon/components/pipeline-step-form/component.js @@ -1,22 +1,15 @@ import Component from '@ember/component'; import layout from './template'; import { set, get } from '@ember/object'; +import { inject as service } from '@ember/service'; const stepOneChoice = [{ id: 'scm', }]; -const stepsChoices = [{ - id: 'task', - name: 'run a script' - },{ - id: 'build', - name: 'publish an image' - } -]; - export default Component.extend({ layout, + intl: service(), selectedModel: function(){ return get(this, 'model')[get(this, 'type')] }.property('model','type'), @@ -29,7 +22,19 @@ export default Component.extend({ if(stepMode === 'scm'){ set(this, 'stepsTypeChoices', stepOneChoice); }else{ - set(this, 'stepsTypeChoices', stepsChoices); + set(this, 'stepsTypeChoices', this.getStepsChoices()); } - } + }, + getStepsChoices() { + const intl = get(this, 'intl') + const stepsChoices = [{ + id: 'task', + name: intl.t('newPipelineStep.stepType.build.stepsChoices.task'), + },{ + id: 'build', + name: intl.t('newPipelineStep.stepType.build.stepsChoices.build'), + } + ]; + return stepsChoices + }, }); diff --git a/lib/pipeline/addon/components/pipeline-step-form/template.hbs b/lib/pipeline/addon/components/pipeline-step-form/template.hbs index db057141c..9702f6df3 100644 --- a/lib/pipeline/addon/components/pipeline-step-form/template.hbs +++ b/lib/pipeline/addon/components/pipeline-step-form/template.hbs @@ -40,4 +40,4 @@ modalOpts=modalOpts modalState=modalState }} -{{/if}} \ No newline at end of file +{{/if}} diff --git a/lib/pipeline/addon/components/pipeline-step-task/template.hbs b/lib/pipeline/addon/components/pipeline-step-task/template.hbs index 63f46b1c0..ba4c050e5 100644 --- a/lib/pipeline/addon/components/pipeline-step-task/template.hbs +++ b/lib/pipeline/addon/components/pipeline-step-task/template.hbs @@ -1,6 +1,6 @@
- +
{{#each environmentTypes as |envType| }} {{radio-button id=envType.label selection=selectedType value=envType.label disabled=(if (eq modalOpts.type 'review') true false)}} @@ -89,21 +89,21 @@
{{else}}
- +
{{input value=runScriptConfig.entrypoint - placeholder="If you want use the default entrypoint, just leave me empty" + placeholder=(t 'newPipelineStep.stepType.task.entryPoint.placeholder') disabled=(if (eq modalOpts.type 'review') true false) }}
- +
{{input value=runScriptConfig.command - placeholder="Arguments of entrypoint" + placeholder=(t 'newPipelineStep.stepType.task.command.placeholder') disabled=(if (eq modalOpts.type 'review') true false) }}
@@ -129,4 +129,4 @@ disabled=(if (eq modalOpts.type 'review') true false) }} -{{/if}} \ No newline at end of file +{{/if}} diff --git a/lib/pipeline/addon/components/pipeline-trigger/template.hbs b/lib/pipeline/addon/components/pipeline-trigger/template.hbs index d806a2dd2..5e19312fb 100644 --- a/lib/pipeline/addon/components/pipeline-trigger/template.hbs +++ b/lib/pipeline/addon/components/pipeline-trigger/template.hbs @@ -9,7 +9,7 @@ {{#if selectedModel.sourceCodeConfig.url}} {{#unless selectedRepo.permissions.admin}} - {{banner-message color='bg-warning mb-0 mt-10' message='No permission to set webhook'}} + {{banner-message color='bg-warning mb-0 mt-10' message=(t 'newPipelineStep.stepType.scm.noWebhook')}} {{/unless}} {{/if}} @@ -21,7 +21,7 @@ {{#if selectedModel.sourceCodeConfig.url}} {{#unless selectedRepo.permissions.admin}} - {{banner-message color='bg-warning mb-0 mt-10' message='No permission to set webhook'}} + {{banner-message color='bg-warning mb-0 mt-10' message=(t 'newPipelineStep.stepType.scm.noWebhook')}} {{/unless}} {{/if}} @@ -34,7 +34,7 @@ {{#if selectedModel.sourceCodeConfig.url}} {{#unless selectedRepo.permissions.admin}} - {{banner-message color='bg-warning mb-0 mt-10' message='No permission to set webhook'}} + {{banner-message color='bg-warning mb-0 mt-10' message=(t 'newPipelineStep.stepType.scm.noWebhook')}} {{/unless}} {{/if}} @@ -97,4 +97,4 @@ {{/if}} - \ No newline at end of file + diff --git a/lib/pipeline/addon/components/step-scm/template.hbs b/lib/pipeline/addon/components/step-scm/template.hbs index a6c17a6b3..b63c0992d 100644 --- a/lib/pipeline/addon/components/step-scm/template.hbs +++ b/lib/pipeline/addon/components/step-scm/template.hbs @@ -45,7 +45,7 @@ {{else}} @@ -89,13 +89,13 @@ optionValuePath="url" readOnly=readOnly }} - @@ -118,7 +118,7 @@
{{radio-button disabled=(or (eq modalOpts.type 'review') (and (not-eq type.value 'only') allowOnly)) id=type.value selection=selectedModel.sourceCodeConfig.branchCondition value=type.value}}
{{#if (not-eq type.value 'all')}} diff --git a/lib/pipeline/addon/import/template.hbs b/lib/pipeline/addon/import/template.hbs index 944bf392d..b1e3a04a2 100644 --- a/lib/pipeline/addon/import/template.hbs +++ b/lib/pipeline/addon/import/template.hbs @@ -1,9 +1,9 @@
-

Import pipeline.yml

+

{{t 'importPage.header'}}

-{{input-text-file mode='yaml' accept=".yml, .yaml" name="pipeline.yml" canChangeName=false value=compose placeholder="pipelinesPage.importPlaceHolder"}} +{{input-text-file mode='yaml' accept=".yml, .yaml" name="pipeline.yaml" canChangeName=false value=compose placeholder="pipelinesPage.importPlaceHolder"}}
{{top-errors errors=errors}} diff --git a/lib/pipeline/addon/new-pipeline/template.hbs b/lib/pipeline/addon/new-pipeline/template.hbs index d9147880d..bf9f47a3b 100644 --- a/lib/pipeline/addon/new-pipeline/template.hbs +++ b/lib/pipeline/addon/new-pipeline/template.hbs @@ -1,9 +1,11 @@
-

Add Pipeline

+

{{t 'newPipeline.header'}}

-

{{input type="text" value=model.pipeline.name classNames="form-control" placeholder="Pipeline Name"}}

+

{{input type="text" value=model.pipeline.name classNames="form-control" + placeholder=(t 'newPipeline.name.placeholder')}} +

@@ -30,4 +32,4 @@
{{#save-cancel class="pipeline-save-cancel" createLabel="newPipeline.add" save="save" cancel="cancel"}} {{/save-cancel}} -
\ No newline at end of file + diff --git a/lib/pipeline/addon/utils/branchConditionsEnums.js b/lib/pipeline/addon/utils/branchConditionsEnums.js index 41c7eae9f..c2e68008d 100644 --- a/lib/pipeline/addon/utils/branchConditionsEnums.js +++ b/lib/pipeline/addon/utils/branchConditionsEnums.js @@ -1,11 +1,11 @@ -export default [ +export default [ { value: 'only', - label: 'Only the branch' + label: 'newPipelineStep.stepType.scm.branchConditionsEnums.only' }, { value: 'except', - label: 'Everything but' + label: 'newPipelineStep.stepType.scm.branchConditionsEnums.except' }, { value: 'all', - label: 'All branches' - }] \ No newline at end of file + label: 'newPipelineStep.stepType.scm.branchConditionsEnums.all' + }] diff --git a/lib/pipeline/translations/en-us.yaml b/lib/pipeline/translations/en-us.yaml index 1c56d1383..226077705 100644 --- a/lib/pipeline/translations/en-us.yaml +++ b/lib/pipeline/translations/en-us.yaml @@ -166,6 +166,11 @@ newPipelineStep: importFromRepo: Import Pipeline From Repository importPipelineSuccess: Imported From Branch {branch} importPipelineFail: No Pipeline Found + branchConditionsEnums: + only: Only the branch + except: Everything but + all: All branches + noWebhook: No permission to set webhook build: here: here label: publish an image @@ -182,15 +187,22 @@ newPipelineStep: pushWarning3: to authenticate it. scope: "Scope: Available to all namespaces in this project" registryExist: Registry {registry} registered with {username} + stepsChoices: + task: run a script + build: publish an image task: label: run a script runAsService: Run As a Service runAsServiceTip: Click this to make it a long running process/container. shellScript: Shell Script customEntryPoint: Custom Entrypoint - command: Command + command: + label: Command + placeholder: Arguments of entrypoint commandLabel: 'sh' - entryPoint: EntryPoint + entryPoint: + label: EntryPoint + placeholder: If you want use the default entrypoint, just leave me empty timeout: Timeout timeoutWarning: If a step does not complete by the specified amount of time (in minutes; at least 3), then the build will be terminated automatically and marked as Fail. minutes: minutes @@ -204,6 +216,8 @@ newPipelineStep: targetEnv: label: Target another environment tip: Default target is current environment, if you want target another enviroment, then check this option. + language: + header: Language Environment authPage: github: @@ -300,3 +314,6 @@ authPage: pre: Authenticate with GitHub preVariable: Enable Pipeline post: Creating + +importPage: + header: Import pipeline.yaml diff --git a/lib/pipeline/translations/zh-hans.yaml b/lib/pipeline/translations/zh-hans.yaml index faa206fb1..6a6839588 100644 --- a/lib/pipeline/translations/zh-hans.yaml +++ b/lib/pipeline/translations/zh-hans.yaml @@ -167,6 +167,11 @@ newPipelineStep: importFromRepo: 从代码库导入Pipeline配置 importPipelineSuccess: 从{branch}分支导入 importPipelineFail: 没有发现Pipeline + branchConditionsEnums: + only: Only the branch + except: Everything but + all: All branches + noWebhook: No permission to set webhook build: here: 这里 label: 上传镜像 @@ -183,15 +188,22 @@ newPipelineStep: pushWarning3: 去认证 scope: "范围:可用于此项目中的所有命名空间" registryExist: 使用{username}注册的镜像仓库{registry} + stepsChoices: + task: run a script + build: 发布镜像 task: label: 运行一个脚本 runAsService: 作为服务运行 runAsServiceTip: 单击此按钮使之成为一个长时间运行的进程/容器 shellScript: Shell脚本 customEntryPoint: 自定义Entrypoint - command: Command + command: + label: 命令 + placeholder: Arguments of entrypoint commandLabel: 'sh' - entryPoint: EntryPoint + entryPoint: + label: EntryPoint + placeholder: If you want use the default entrypoint, just leave me empty timeout: 超时时间 timeoutWarning: 如果某个步骤在指定时间(以分钟为单位,默认3分钟)内未完成,则构建将自动终止并标记为“失败” minutes: 分钟 @@ -205,6 +217,8 @@ newPipelineStep: targetEnv: label: 目标环境非本环境 tip: 默认目标环境为本环境,如果要将目标环境设定为其他环境,请勾选本选项 + language: + header: 语言环境 authPage: github: @@ -301,3 +315,5 @@ authPage: pre: GitHub验证 preVariable: 启用Pipeline post: 等待GitHub返回 +importPage: + header: 导入 pipeline.yaml