Skip to content

Commit

Permalink
Merge pull request #7324 from christianvogt/git-service-i18n
Browse files Browse the repository at this point in the history
localize git-service package
  • Loading branch information
openshift-merge-robot committed Nov 25, 2020
2 parents 360f2f9 + a76ce7d commit 3156dcf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
4 changes: 4 additions & 0 deletions frontend/packages/git-service/locales/en/git-service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"Unable to find repository": "Unable to find repository",
"Repository path {{path}} does not match expected name {{name}}": "Repository path {{path}} does not match expected name {{name}}"
}
8 changes: 6 additions & 2 deletions frontend/packages/git-service/src/services/gitlab-service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Gitlab } from 'gitlab';
import * as GitUrlParse from 'git-url-parse';
import i18n from 'i18next';
import {
GitSource,
SecretType,
Expand Down Expand Up @@ -39,10 +40,13 @@ export class GitlabService extends BaseService {
}
const repo: GitlabRepo = await this.client.Projects.show(this.metadata.fullName);
if (!repo) {
throw new Error('Unable to find any repo');
throw new Error(i18n.t('git-service~Unable to find repository'));
} else if (repo.path_with_namespace !== this.metadata.fullName) {
throw new Error(
`Repository path ${repo.path_with_namespace} does not match expected name ${this.metadata.fullName}`,
i18n.t('git-service~Repository path {{path}} does not match expected name {{name}}', {
path: repo.path_with_namespace,
name: this.metadata.fullName,
}),
);
}

Expand Down
23 changes: 12 additions & 11 deletions frontend/public/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,31 @@ i18n
'cluster-update-modal',
'cluster-version',
'console-app',
'console-shared',
'container-security',
'create-catalog-source',
'custom-resource-definition',
'dashboard',
'details-page',
'devconsole',
'dropdown',
'editor',
'email-receiver-form',
'environment',
'filter-toolbar',
'github-idp-form',
'gitlab-idp-form',
'git-service',
'global-config',
'google-idp-form',
'htpasswd-idp-form',
'idp-cafile-input',
'idp-name-input',
'image-stream',
'ingress',
'knative-plugin',
'keystone-idp-form',
'kubevirt-plugin',
'language-preferences-modal',
'ldap-idp-form',
'limit-range',
Expand All @@ -85,10 +92,14 @@ i18n
'machine-config-pools',
'machine-health-checks',
'machine-sets',
'metal3-plugin',
'modal',
'monitoring',
'namespace',
'nav',
'network-policy',
'network-route',
'network-service',
'nodes',
'oauth',
'openid-idp-form',
Expand All @@ -112,18 +123,8 @@ i18n
'tour',
'utils',
'webhook-receiver-form',
'yaml',
'network-service',
'network-route',
'network-policy',
'ingress',
'console-shared',
'workload',
'devconsole',
'knative-plugin',
'kubevirt-plugin',
'metal3-plugin',
'container-security',
'yaml',
],
defaultNS: 'public',
nsSeparator: '~',
Expand Down

0 comments on commit 3156dcf

Please sign in to comment.