Skip to content

Commit 2421e46

Browse files
author
Atanas Mirchev
committed
Localization of the RC Detail and -List views
1 parent 12511ac commit 2421e46

22 files changed

+417
-57
lines changed

i18n/messages-en.xtb

Lines changed: 49 additions & 0 deletions
Large diffs are not rendered by default.

i18n/messages-ja.xtb

Lines changed: 50 additions & 1 deletion
Large diffs are not rendered by default.

src/app/frontend/replicationcontrollerdetail/actionbar.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616

1717
<md-button class="md-icon-button" ng-click="$ctrl.redirectToDeployPage()">
1818
<md-icon class="kd-actionbar-icon-button">add</md-icon>
19-
<md-tooltip md-direction="bottom">Deploy a containerized app</md-tooltip>
19+
<md-tooltip md-direction="bottom">
20+
{{::$ctrl.i18n.MSG_RC_DETAIL_ACTION_BAR_DEPLOY_TOOLTIP}}
21+
</md-tooltip>
2022
</md-button>
2123
<md-button class="md-icon-button" ng-click="$ctrl.handleUpdateReplicasDialog()">
2224
<md-icon class="kd-actionbar-icon-button">mode_edit</md-icon>
23-
<md-tooltip md-direction="bottom">Edit number of pods</md-tooltip>
25+
<md-tooltip md-direction="bottom">
26+
{{::$ctrl.i18n.MSG_RC_DETAIL_ACTION_BAR_EDIT_PODS_TOOLTIP}}
27+
</md-tooltip>
2428
</md-button>
25-
<kd-actionbar-detail-buttons resource-kind-name="Replication Controller"
29+
<kd-actionbar-detail-buttons resource-kind-name="{{::$ctrl.i18n.MSG_RC_DETAIL_REPLICATION_CONTROLLER_LABEL}}"
2630
type-meta="$ctrl.details.typeMeta"
2731
object-meta="$ctrl.details.objectMeta">
2832
</kd-actionbar-detail-buttons>

src/app/frontend/replicationcontrollerdetail/actionbar_controller.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ export class ActionBarController {
3939

4040
/** @export {boolean} */
4141
this.showFabIcons = false;
42+
43+
/** @export */
44+
this.i18n = i18n;
4245
}
4346

4447
/**
@@ -66,3 +69,15 @@ export class ActionBarController {
6669
this.details.podInfo.current, this.details.podInfo.desired);
6770
}
6871
}
72+
73+
const i18n = {
74+
/** @export {string} @desc Tooltip for the '+' button on the action bar of a replication
75+
controller details view. */
76+
MSG_RC_DETAIL_ACTION_BAR_DEPLOY_TOOLTIP: goog.getMsg('Deploy a containerized app'),
77+
/** @export {string} @desc Tooltip for the 'edit' button on the action bar of a replication
78+
controller details view.*/
79+
MSG_RC_DETAIL_ACTION_BAR_EDIT_PODS_TOOLTIP: goog.getMsg('Edit number of pods'),
80+
/** @export {string} @desc Label 'Replication Controller' which appears at the top of the
81+
delete dialog, opened from a RC details page. */
82+
MSG_RC_DETAIL_REPLICATION_CONTROLLER_LABEL: goog.getMsg('Replication Controller'),
83+
};

src/app/frontend/replicationcontrollerdetail/replicationcontrollerdetail.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
<div layout="column">
1818
<md-content>
1919
<md-tabs md-border-bottom md-dynamic-height>
20-
<md-tab label="Overview">
20+
<md-tab label="{{::ctrl.i18n.MSG_RC_DETAIL_OVERVIEW_LABEL}}">
2121
<kd-replication-controller-info replication-controller="::ctrl.replicationControllerDetail">
2222
</kd-replication-controller-info>
2323

2424
<kd-content-card ng-if="::ctrl.replicationControllerDetail.serviceList.services.length">
25-
<kd-title>Services</kd-title>
25+
<kd-title>{{::ctrl.i18n.MSG_RC_DETAIL_SERVICES_TITLE}}</kd-title>
2626
<kd-content>
2727
<kd-service-card-list
2828
services="::ctrl.replicationControllerDetail.serviceList.services">
@@ -31,15 +31,15 @@
3131
</kd-content-card>
3232

3333
<kd-content-card>
34-
<kd-title>Pods</kd-title>
34+
<kd-title>{{::ctrl.i18n.MSG_RC_DETAIL_PODS_TITLE}}</kd-title>
3535
<kd-content>
3636
<kd-pod-card-list pod-list="::ctrl.replicationControllerDetail.pods"
3737
logs-href-fn="::ctrl.getPodLogsHref(pod)" with-statuses="true">
3838
</kd-pod-card-list>
3939
</kd-content>
4040
</kd-content-card>
4141
</md-tab>
42-
<md-tab label="Events">
42+
<md-tab label="{{::ctrl.i18n.MSG_RC_DETAIL_EVENTS_LABEL}}">
4343
<kd-event-card-list events="::ctrl.events">
4444
</kd-event-card-list>
4545
</md-tab>

src/app/frontend/replicationcontrollerdetail/replicationcontrollerdetail_controller.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export default class ReplicationControllerDetailController {
4040

4141
/** @private {!../common/resource/resourcedetail.StateParams} */
4242
this.stateParams_ = $stateParams;
43+
44+
/** @export */
45+
this.i18n = i18n;
4346
}
4447

4548
/**
@@ -73,3 +76,18 @@ export default class ReplicationControllerDetailController {
7376
this.stateParams_.objectNamespace, this.stateParams_.objectName, pod.objectMeta.name));
7477
}
7578
}
79+
80+
const i18n = {
81+
/** @export {string} @desc Title 'Pods', which appears at the top of the pods list on the
82+
replication controller detail view. */
83+
MSG_RC_DETAIL_PODS_TITLE: goog.getMsg('Pods'),
84+
/** @export {string} @desc Title 'Service', which appears at the top of the services list on the
85+
replication controller detail view. */
86+
MSG_RC_DETAIL_SERVICES_TITLE: goog.getMsg('Services'),
87+
/** @export {string} @desc Label 'Overview' for the left navigation tab on the replication
88+
controller details page. */
89+
MSG_RC_DETAIL_OVERVIEW_LABEL: goog.getMsg('Overview'),
90+
/** @export {string} @desc Label 'Events' for the right navigation tab on the replication
91+
controller details page. */
92+
MSG_RC_DETAIL_EVENTS_LABEL: goog.getMsg('Events'),
93+
};

src/app/frontend/replicationcontrollerdetail/replicationcontrollerinfo.html

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,49 @@
1515
-->
1616

1717
<kd-info-card>
18-
<kd-info-card-header>Resource Details</kd-info-card-header>
19-
<kd-info-card-section name="Details">
20-
<kd-info-card-entry title="Name">
18+
<kd-info-card-header>{{::$ctrl.i18n.MSG_RC_DETAIL_RESOURCE_DETAILS_TITLE}}</kd-info-card-header>
19+
<kd-info-card-section name="{{::$ctrl.i18n.MSG_RC_DETAIL_DETAILS_SUBTITLE}}">
20+
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_RC_DETAIL_NAME_LABEL}}">
2121
<kd-middle-ellipsis
2222
display-string="{{::$ctrl.replicationController.objectMeta.name}}">
2323
</kd-middle-ellipsis>
2424
</kd-info-card-entry>
25-
<kd-info-card-entry title="Namespace">
25+
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_RC_DETAIL_NAMESPACE_LABEL}}">
2626
{{::$ctrl.replicationController.objectMeta.namespace}}
2727
</kd-info-card-entry>
28-
<kd-info-card-entry title="Label selector">
28+
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_RC_DETAIL_LABEL_SELECTOR_LABEL}}">
2929
<kd-labels labels="::$ctrl.replicationController.labelSelector"></kd-labels>
3030
</kd-info-card-entry>
31-
<kd-info-card-entry title="Labels">
31+
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_RC_DETAIL_LABELS_LABEL}}">
3232
<kd-labels labels="::$ctrl.replicationController.objectMeta.labels"></kd-labels>
3333
</kd-info-card-entry>
34-
<kd-info-card-entry title="Images">
34+
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_RC_DETAIL_IMAGES_LABEL}}">
3535
<div ng-repeat="image in $ctrl.replicationController.containerImages">
3636
<kd-middle-ellipsis display-string="{{::image}}"></kd-middle-ellipsis>
3737
</div>
3838
</kd-info-card-entry>
3939
</kd-info-card-section>
4040

41-
<kd-info-card-section name="Status">
42-
<kd-info-card-entry title="Pods">
41+
<kd-info-card-section name="{{::$ctrl.i18n.MSG_RC_DETAIL_STATUS_SUBTITLE}}">
42+
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_RC_DETAIL_PODS_LABEL}}">
4343
<div ng-if="!$ctrl.areDesiredPodsRunning()">
44-
{{::$ctrl.replicationController.podInfo.current}} created,
45-
{{::$ctrl.replicationController.podInfo.desired}} desired
44+
{{::$ctrl.i18n.MSG_RC_DETAIL_PODS_CREATED_LABEL}},
45+
{{::$ctrl.i18n.MSG_RC_DETAIL_PODS_DESIRED_LABEL}}
4646
</div>
4747
<div ng-if="$ctrl.areDesiredPodsRunning()">
48-
{{::$ctrl.replicationController.podInfo.running}} running
48+
{{::$ctrl.i18n.MSG_RC_DETAIL_PODS_RUNNING_LABEL}}
4949
</div>
5050
</kd-info-card-entry>
51-
<kd-info-card-entry title="Pods status" ng-if="!$ctrl.areDesiredPodsRunning()">
51+
<kd-info-card-entry title="{{::$ctrl.i18n.MSG_RC_DETAIL_PODS_STATUS_LABEL}}" ng-if="!$ctrl.areDesiredPodsRunning()">
5252
<div ng-if="!$ctrl.areDesiredPodsRunning()">
5353
<div ng-if="::$ctrl.replicationController.podInfo.pending" class="kd-comma-separated-item">
54-
{{::$ctrl.replicationController.podInfo.pending}} pending<!-- Collapse whitespace
55-
--></div>
54+
{{::$ctrl.i18n.MSG_RC_DETAIL_PODS_PENDING_LABEL}}
55+
</div>
5656
<div ng-if="::$ctrl.replicationController.podInfo.failed" class="kd-comma-separated-item">
57-
{{::$ctrl.replicationController.podInfo.failed}} failed<!-- Collapse whitespace
58-
--></div>
57+
{{::$ctrl.i18n.MSG_RC_DETAIL_PODS_FAILED_LABEL}}
58+
</div>
5959
<div ng-if="::$ctrl.replicationController.podInfo.running" class="kd-comma-separated-item">
60-
{{::$ctrl.replicationController.podInfo.running}} running
60+
{{::$ctrl.i18n.MSG_RC_DETAIL_PODS_RUNNING_LABEL}}
6161
</div>
6262
</div>
6363
</kd-info-card-entry>

src/app/frontend/replicationcontrollerdetail/replicationcontrollerinfo_component.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ export default class ReplicationControllerInfoController {
2525
* @export {!backendApi.ReplicationControllerDetail}
2626
*/
2727
this.replicationController;
28+
29+
/** @export */
30+
this.i18n = i18n(this.replicationController);
2831
}
2932

3033
/**
@@ -50,3 +53,62 @@ export const replicationControllerInfoComponent = {
5053
'replicationController': '<',
5154
},
5255
};
56+
57+
/**
58+
* @param {!backendApi.ReplicationControllerDetail} rcDetail
59+
* @return {!Object} a dictionary of translatable messages
60+
*/
61+
function i18n(rcDetail) {
62+
return {
63+
/** @export {string} @desc Title 'Resource details' at the top of the replication controller
64+
details page.*/
65+
MSG_RC_DETAIL_RESOURCE_DETAILS_TITLE: goog.getMsg('Resource details'),
66+
/** @export {string} @desc Subtitle 'Details' for the left section with general information
67+
about a replication controller on the replication controller details page.*/
68+
MSG_RC_DETAIL_DETAILS_SUBTITLE: goog.getMsg('Details'),
69+
/** @export {string} @desc Label 'Namespace' for the replication controller namespace on the
70+
replication controller details page.*/
71+
MSG_RC_DETAIL_NAMESPACE_LABEL: goog.getMsg('Namespace'),
72+
/** @export {string} @desc Label 'Name' for the replication controller name on the replication
73+
controller details page.*/
74+
MSG_RC_DETAIL_NAME_LABEL: goog.getMsg('Name'),
75+
/** @export {string} @desc Label 'Label selector' for the replication controller's labels list
76+
on the replication controller details page.*/
77+
MSG_RC_DETAIL_LABELS_LABEL: goog.getMsg('Labels'),
78+
/** @export {string} @desc Label 'Label selector' for the replication controller's selector on
79+
the replication controller details page.*/
80+
MSG_RC_DETAIL_LABEL_SELECTOR_LABEL: goog.getMsg('Label selector'),
81+
/** @export {string} @desc Label 'Images' for the list of images used in a replication
82+
controller, on its details page. */
83+
MSG_RC_DETAIL_IMAGES_LABEL: goog.getMsg('Images'),
84+
/** @export {string} @desc Subtitle 'Status' for the right section with pod status information
85+
on the replication controller details page.*/
86+
MSG_RC_DETAIL_STATUS_SUBTITLE: goog.getMsg('Status'),
87+
/** @export {string} @desc Label 'Pods' for the pods in a replication controller on its details
88+
page.*/
89+
MSG_RC_DETAIL_PODS_LABEL: goog.getMsg('Pods'),
90+
/** @export {string} @desc Label 'Pods status' for the status of the pods in a replication
91+
controller, on the replication controller details page.*/
92+
MSG_RC_DETAIL_PODS_STATUS_LABEL: goog.getMsg('Pods status'),
93+
/** @export {string} @desc The message says that that many pods were created
94+
(replication controller details page). */
95+
MSG_RC_DETAIL_PODS_CREATED_LABEL:
96+
goog.getMsg('{$podsCount} created', {'podsCount': rcDetail.podInfo.current}),
97+
/** @export {string} @desc The message says that that many pods are running
98+
(replication controller details page). */
99+
MSG_RC_DETAIL_PODS_RUNNING_LABEL:
100+
goog.getMsg('{$podsCount} running', {'podsCount': rcDetail.podInfo.running}),
101+
/** @export {string} @desc The message says that that many pods are pending
102+
(replication controller details page). */
103+
MSG_RC_DETAIL_PODS_PENDING_LABEL:
104+
goog.getMsg('{$podsCount} pending', {'podsCount': rcDetail.podInfo.pending}),
105+
/** @export {string} @desc The message says that that many pods have failed
106+
(replication controller details page). */
107+
MSG_RC_DETAIL_PODS_FAILED_LABEL:
108+
goog.getMsg('{$podsCount} failed', {'podsCount': rcDetail.podInfo.failed}),
109+
/** @export {string} @desc The message says that that many pods are desired to run
110+
(replication controller details page). */
111+
MSG_RC_DETAIL_PODS_DESIRED_LABEL:
112+
goog.getMsg('{$podsCount} desired', {'podsCount': rcDetail.podInfo.desired}),
113+
};
114+
}

src/app/frontend/replicationcontrollerdetail/updatereplicas.html

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,29 @@
1616

1717
<md-dialog aria-label="Create a new namespace" layout="column">
1818
<md-dialog-content layout-padding>
19-
<h4 class="md-title">Set desired number of pods</h4>
19+
<h4 class="md-title">{{::ctrl.i18n.MSG_RC_DETAIL_UPDATE_PODS_COUNT_TITLE}}</h4>
2020
<div>
21-
Replication controller {{ctrl.replicationController}} will be updated to reflect the desired
22-
count.<br/>
21+
{{::ctrl.i18n.MSG_RC_DETAIL_UPDATE_PODS_COUNT_USER_HELP}}<br/>
2322
<span class="kd-updatereplicas-pod-status">
24-
Current status: {{ctrl.currentPods}} created, {{ctrl.desiredPods}} desired
23+
{{::ctrl.i18n.MSG_RC_DETAIL_UPDATE_PODS_COUNT_STATUS_SUBTITLE}}
2524
</span>
2625
</div>
2726
<form name="ctrl.updateReplicasForm" ng-submit="ctrl.updateReplicas()" novalidate>
2827
<md-input-container class="md-block">
29-
<label>Number of pods</label>
28+
<label>{{::ctrl.i18n.MSG_RC_DETAIL_NUMBER_OF_PODS_LABEL}}</label>
3029
<input name="podCount" type="number" kd-validate="integer" min="1" ng-model="ctrl.replicas"
3130
required kd-warn-threshold="100" kd-warn-threshold-bind="showWarning">
3231
<ng-messages for="ctrl.updateReplicasForm.podCount.$error" role="alert">
33-
<ng-message when="required">Number of pods is required.</ng-message>
34-
<ng-message when="number,kdValidInteger">Must be a positive integer.</ng-message>
32+
<ng-message when="required">{{::ctrl.i18n.MSG_RC_DETAIL_NUMBER_OF_PODS_REQUIRED_WARNING}}</ng-message>
33+
<ng-message when="number,kdValidInteger">{{::ctrl.i18n.MSG_RC_DETAIL_NUMBER_OF_PODS_INTEGER_WARNING}}</ng-message>
3534
</ng-messages>
3635
<span class="kd-warn-threshold" ng-show="showWarning">
37-
Setting high number of pods may cause performance issues of the cluster and Dashboard UI.
36+
{{::ctrl.i18n.MSG_RC_DETAIL_NUMBER_OF_PODS_HIGH_WARNING}}
3837
</span>
3938
</md-input-container>
4039
<md-dialog-actions layout="row">
41-
<md-button class="md-primary" ng-click="ctrl.cancel()">Cancel</md-button>
42-
<md-button class="md-primary" type="submit">OK</md-button>
40+
<md-button class="md-primary" ng-click="ctrl.cancel()">{{::ctrl.i18n.MSG_RC_DETAIL_UPDATE_PODS_COUNT_CANCEL_ACTION}}</md-button>
41+
<md-button class="md-primary" type="submit">{{::ctrl.i18n.MSG_RC_DETAIL_UPDATE_PODS_COUNT_OK_ACTION}}</md-button>
4342
</md-dialog-actions>
4443
</form>
4544
</md-dialog-content>

src/app/frontend/replicationcontrollerdetail/updatereplicas_controller.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export default class UpdateReplicasDialogController {
6464

6565
/** @export {!angular.FormController} Initialized from the template */
6666
this.updateReplicasForm;
67+
68+
/** @export */
69+
this.i18n = i18n(replicationController, currentPods, desiredPods);
6770
}
6871

6972
/**
@@ -112,3 +115,47 @@ export default class UpdateReplicasDialogController {
112115
this.mdDialog_.hide();
113116
}
114117
}
118+
119+
/**
120+
* @param {string} replicationController
121+
* @param {number} currentPods
122+
* @param {number} desiredPods
123+
* @return {!Object}
124+
*/
125+
function i18n(replicationController, currentPods, desiredPods) {
126+
return {
127+
/** @export {string} @desc Title for the pod count update dialog (for a replication controller).*/
128+
MSG_RC_DETAIL_UPDATE_PODS_COUNT_TITLE: goog.getMsg('Set desired number of pods'),
129+
/** @export {string} @desc User help for the pod count update dialog (on the replication
130+
controllers detail page). */
131+
MSG_RC_DETAIL_UPDATE_PODS_COUNT_USER_HELP: goog.getMsg(
132+
'Replication controller {$rcName} will be updated to reflect the desired count.',
133+
{'rcName': replicationController}),
134+
/** @export {string} @desc Status text for a replication controller, showing the number of
135+
created and desired pods.*/
136+
MSG_RC_DETAIL_UPDATE_PODS_COUNT_STATUS_SUBTITLE:
137+
goog.getMsg('Current status: {$createdPods} created, {$desiredPods} desired', {
138+
'createdPods': currentPods,
139+
'desiredPods': desiredPods,
140+
}),
141+
/** @export {string} @desc Label 'Number of pods', which appears as a placeholder for the pods
142+
count input on the "update pods count" dialog (for a replication controller).*/
143+
MSG_RC_DETAIL_NUMBER_OF_PODS_LABEL: goog.getMsg('Number of pods'),
144+
/** @export {string} @desc This warning appears when the user does not specify a pods count on
145+
the "update number of pods" dialog (for a replication controller).*/
146+
MSG_RC_DETAIL_NUMBER_OF_PODS_REQUIRED_WARNING: goog.getMsg('Number of pods is required'),
147+
/** @export {string} @desc This warning appears when the specified pods count on
148+
the "update number of pods" dialog is not positive or non-integer.*/
149+
MSG_RC_DETAIL_NUMBER_OF_PODS_INTEGER_WARNING: goog.getMsg('Must be a positive integer'),
150+
/** @export {string} @desc This warning appears when the specified pods count (on the "update
151+
number of pods" dialog) is very high. */
152+
MSG_RC_DETAIL_NUMBER_OF_PODS_HIGH_WARNING: goog.getMsg(
153+
'Setting high number of pods may cause performance issues of the cluster and Dashboard UI.'),
154+
/** @export {string} @desc Action 'Cancel' for the cancel button on the "update number of pods"
155+
dialog. */
156+
MSG_RC_DETAIL_UPDATE_PODS_COUNT_CANCEL_ACTION: goog.getMsg('Cancel'),
157+
/** @export {string} @desc Action 'OK' for the confirmation button on the "update number of pods
158+
dialog". */
159+
MSG_RC_DETAIL_UPDATE_PODS_COUNT_OK_ACTION: goog.getMsg('OK'),
160+
};
161+
}

0 commit comments

Comments
 (0)