Skip to content

Commit bde722a

Browse files
committed
Make views translatable
1 parent 2e2b474 commit bde722a

21 files changed

+420
-173
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
bower_components/*
22
node_modules/*
3-
templates.js
3+
object-describer-translations.js
4+
templates.js

Gruntfile.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module.exports = function(grunt) {
8080
},
8181
concat: {
8282
app: {
83-
src: [ 'object-describer.js', 'templates.js' ],
83+
src: [ 'object-describer.js', 'object-describer-translations.js', 'templates.js' ],
8484
dest: 'dist/object-describer.js'
8585
}
8686
},
@@ -89,6 +89,20 @@ module.exports = function(grunt) {
8989
src: 'views/**.html',
9090
dest: 'templates.js'
9191
}
92+
},
93+
nggettext_extract: {
94+
pot: {
95+
files: {
96+
'po/kubernetes-object-describer.pot': ['views/*.html']
97+
}
98+
}
99+
},
100+
nggettext_compile: {
101+
all: {
102+
files: {
103+
'object-describer-translations.js': ['po/*.po']
104+
}
105+
}
92106
}
93107
});
94108

@@ -99,6 +113,9 @@ module.exports = function(grunt) {
99113
grunt.loadNpmTasks('grunt-contrib-concat');
100114
grunt.loadNpmTasks('grunt-wiredep');
101115
grunt.loadNpmTasks('grunt-angular-templates');
116+
grunt.loadNpmTasks('grunt-angular-gettext');
117+
118+
grunt.registerTask('update-po', ['nggettext_extract']);
102119

103120
grunt.registerTask('serve', [
104121
'less',
@@ -109,10 +126,11 @@ module.exports = function(grunt) {
109126
]);
110127

111128
grunt.registerTask('build', [
129+
'nggettext_compile',
112130
'less',
113131
'ngtemplates',
114132
'concat'
115133
]);
116134
grunt.registerTask('default', ['serve']);
117135

118-
};
136+
};

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"dist/object-describer.js"
2525
],
2626
"dependencies": {
27-
"angular": "~1.3.8"
27+
"angular": "~1.3.8",
28+
"angular-gettext": "~2.1.0"
2829
},
2930
"devDependencies": {
3031
"bootstrap": "~3.3.4",

dist/object-describer.js

Lines changed: 87 additions & 83 deletions
Large diffs are not rendered by default.

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ <h1>Replication Controller describer</h1>
4545
<!-- build:js(.) scripts/vendor.js -->
4646
<!-- bower:js -->
4747
<script src="bower_components/angular/angular.js"></script>
48+
<script src="bower_components/angular-gettext/dist/angular-gettext.js"></script>
4849
<!-- endbower -->
4950
<!-- endbuild -->
5051

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
"dependencies": {},
1111
"devDependencies": {
1212
"grunt": "~0.4.5",
13+
"grunt-angular-gettext": "^2.1.3",
14+
"grunt-angular-templates": "~0.5.7",
15+
"grunt-contrib-concat": "~0.5.1",
1316
"grunt-contrib-connect": "~0.9.0",
1417
"grunt-contrib-jshint": "~0.11.1",
1518
"grunt-contrib-less": "~1.0.0",
16-
"grunt-wiredep": "~2.0.0",
1719
"grunt-contrib-watch": "~0.6.1",
18-
"grunt-angular-templates": "~0.5.7",
19-
"grunt-contrib-concat": "~0.5.1"
20+
"grunt-wiredep": "~2.0.0"
2021
},
2122
"scripts": {
2223
"test": "echo \"Error: no test specified\" && exit 1"

po/kubernetes-object-describer.pot

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
msgid ""
2+
msgstr ""
3+
"Content-Type: text/plain; charset=UTF-8\n"
4+
"Content-Transfer-Encoding: 8bit\n"
5+
"Project-Id-Version: \n"
6+
7+
#: views/annotations.html:1
8+
msgid "Annotations"
9+
msgstr ""
10+
11+
#: views/pod.html:28
12+
msgid "Container Statuses"
13+
msgstr ""
14+
15+
#: views/pod-template.html:10
16+
msgid "Containers"
17+
msgstr ""
18+
19+
#: views/metadata.html:6
20+
#: views/pod.html:8
21+
#: views/replication-controller.html:8
22+
#: views/service.html:8
23+
msgid "Created"
24+
msgstr ""
25+
26+
#: views/pod-template.html:5
27+
msgid "DNS policy"
28+
msgstr ""
29+
30+
#: views/containers.html:15
31+
msgid "Env vars"
32+
msgstr ""
33+
34+
#: views/_collapse-long-text.html:3
35+
msgid "Expand"
36+
msgstr ""
37+
38+
#: views/volumes.html:15
39+
msgid "GCE persistent disk"
40+
msgstr ""
41+
42+
#: views/volumes.html:18
43+
msgid "Git repository"
44+
msgstr ""
45+
46+
#: views/service.html:12
47+
msgid "IP"
48+
msgstr ""
49+
50+
#: views/pod.html:22
51+
msgid "IP on node"
52+
msgstr ""
53+
54+
#: views/containers.html:5
55+
msgid "Image"
56+
msgstr ""
57+
58+
#: views/service.html:23
59+
msgid "Ingress points"
60+
msgstr ""
61+
62+
#: views/labels.html:1
63+
msgid "Labels"
64+
msgstr ""
65+
66+
#: views/container-statuses.html:9
67+
msgid "Last State"
68+
msgstr ""
69+
70+
#: views/footer.html:2
71+
msgid "More details..."
72+
msgstr ""
73+
74+
#: views/container-statuses.html:3
75+
#: views/containers.html:3
76+
#: views/metadata.html:2
77+
#: views/pod.html:4
78+
#: views/replication-controller.html:4
79+
#: views/service.html:4
80+
#: views/volumes.html:3
81+
msgid "Name"
82+
msgstr ""
83+
84+
#: views/metadata.html:4
85+
#: views/pod.html:6
86+
#: views/replication-controller.html:6
87+
#: views/service.html:6
88+
msgid "Namespace"
89+
msgstr ""
90+
91+
#: views/pod.html:19
92+
msgid "Node"
93+
msgstr ""
94+
95+
#: views/service.html:16
96+
msgid "None"
97+
msgstr ""
98+
99+
#: views/volumes.html:8
100+
msgid "Path"
101+
msgstr ""
102+
103+
#: views/pod.html:17
104+
msgid "Phase"
105+
msgstr ""
106+
107+
#: views/containers.html:8
108+
#: views/service.html:14
109+
msgid "Ports"
110+
msgstr ""
111+
112+
#: views/container-statuses.html:13
113+
msgid "Ready"
114+
msgstr ""
115+
116+
#: views/replication-controller.html:10
117+
msgid "Replicas"
118+
msgstr ""
119+
120+
#: views/volumes.html:19
121+
msgid "Repository"
122+
msgstr ""
123+
124+
#: views/container-statuses.html:15
125+
msgid "Restart Count"
126+
msgstr ""
127+
128+
#: views/pod-template.html:3
129+
#: views/pod.html:10
130+
msgid "Restart policy"
131+
msgstr ""
132+
133+
#: views/volumes.html:21
134+
msgid "Revision"
135+
msgstr ""
136+
137+
#: views/container-state.html:9
138+
msgid "Running"
139+
msgstr ""
140+
141+
#: views/replication-controller.html:13
142+
#: views/service.html:29
143+
msgid "Selector"
144+
msgstr ""
145+
146+
#: views/pod-template.html:7
147+
#: views/pod.html:12
148+
msgid "Service account"
149+
msgstr ""
150+
151+
#: views/service.html:21
152+
msgid "Session affinity"
153+
msgstr ""
154+
155+
#: views/container-statuses.html:5
156+
msgid "State"
157+
msgstr ""
158+
159+
#: views/pod.html:15
160+
msgid "Status"
161+
msgstr ""
162+
163+
#: views/container-state.html:13
164+
msgid "Terminated"
165+
msgstr ""
166+
167+
#: views/service.html:10
168+
#: views/volumes.html:11
169+
#: views/volumes.html:14
170+
#: views/volumes.html:17
171+
#: views/volumes.html:6
172+
msgid "Type"
173+
msgstr ""
174+
175+
#: views/pod-template.html:12
176+
msgid "Volumes"
177+
msgstr ""
178+
179+
#: views/container-state.html:5
180+
msgid "Waiting"
181+
msgstr ""
182+
183+
#: views/container-state.html:14
184+
msgid "at {{stateDescription.finishedAt | date:'medium'}}"
185+
msgstr ""
186+
187+
#: views/volumes.html:12
188+
msgid "empty directory"
189+
msgstr ""
190+
191+
#: views/volumes.html:7
192+
msgid "host path"
193+
msgstr ""
194+
195+
#: views/annotations.html:2
196+
#: views/container-state.html:1
197+
#: views/container-statuses.html:1
198+
#: views/containers.html:10
199+
#: views/containers.html:17
200+
#: views/containers.html:7
201+
#: views/labels.html:2
202+
#: views/pod.html:25
203+
#: views/volumes.html:1
204+
msgid "none"
205+
msgstr ""
206+
207+
#: views/volumes.html:24
208+
msgid "not specified"
209+
msgstr ""
210+
211+
#: views/container-state.html:10
212+
msgid "since {{stateDescription.startedAt | date:'medium'}}"
213+
msgstr ""
214+
215+
#: views/containers.html:12
216+
msgid "to host port {{port.hostPort}}"
217+
msgstr ""
218+
219+
#: views/container-state.html:15
220+
msgid "with exit code {{stateDescription.exitCode}}"
221+
msgstr ""

views/_collapse-long-text.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<span ng-hide="enableCollapse && value.length > 120">{{value}}</span>
22
<span ng-show="enableCollapse && value.length > 120">
3-
<span class="reveal-contents-link" style="cursor: pointer;" title="Expand">{{value.substring(0, 120)}}<a href="javascript:;">...</a></span>
3+
<span class="reveal-contents-link" style="cursor: pointer;" data-original-title="{{'Expand'|translate}}">{{value.substring(0, 120)}}<a href="javascript:;">...</a></span>
44
<span style="display: none;" class="reveal-contents">{{value}}</span>
5-
</span>
5+
</span>

views/annotations.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<h3>Annotations</h3>
2-
<span ng-if="!resource.metadata.annotations"><em>none</em></span>
1+
<h3 translate>Annotations</h3>
2+
<span ng-if="!resource.metadata.annotations"><em translate>none</em></span>
33
<dl class="dl-horizontal" ng-if="resource.metadata.annotations">
44
<dt ng-repeat-start="(annotationKey, annotationValue) in resource.metadata.annotations" title="{{annotationKey}}">{{annotationKey}}</dt>
55
<dd ng-repeat-end collapse-long-text value="{{annotationValue}}"></dd>
6-
</dl>
6+
</dl>

views/container-state.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<span ng-if="containerState | isEmptyObj"><em>none</em></span>
1+
<span ng-if="containerState | isEmptyObj"><em translate>none</em></span>
22
<span ng-repeat="(state, stateDescription) in containerState | limitTo: 1">
33
<span ng-switch="state">
44
<span ng-switch-when="waiting">
5-
Waiting
5+
<translate>Waiting</translate>
66
<span ng-if="stateDescription.reason">({{stateDescription.reason}})</span>
77
</span>
88
<span ng-switch-when="running">
9-
Running
10-
<span ng-if="stateDescription.startedAt">since {{stateDescription.startedAt | date:'medium'}}</span>
9+
<translate>Running</translate>
10+
<span ng-if="stateDescription.startedAt" translate>since {{stateDescription.startedAt | date:'medium'}}</span>
1111
</span>
1212
<span ng-switch-when="terminated">
13-
Terminated
14-
<span ng-if="stateDescription.finishedAt">at {{stateDescription.finishedAt | date:'medium'}}</span>
15-
<span ng-if="stateDescription.exitCode">with exit code {{stateDescription.exitCode}}</span>
13+
<translate>Terminated</translate>
14+
<span ng-if="stateDescription.finishedAt" translate>at {{stateDescription.finishedAt | date:'medium'}}</span>
15+
<span ng-if="stateDescription.exitCode" translate>with exit code {{stateDescription.exitCode}}</span>
1616
<span ng-if="stateDescription.reason">({{stateDescription.reason}})</span>
1717
</span>
1818
<span ng-switch-default>{{state}}</span>

0 commit comments

Comments
 (0)