Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
a0d92dac
Commit
a0d92dac
authored
Jan 19, 2016
by
Matthew Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add general localizations to nonlocalized pages
For nav/footer purposes.
parent
5e055fb6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
bin/build-locales
bin/build-locales
+16
-0
No files found.
bin/build-locales
View file @
a0d92dac
...
@@ -90,12 +90,21 @@ for (var id in generalIds) {
...
@@ -90,12 +90,21 @@ for (var id in generalIds) {
icuWithIds
[
generalIds
[
id
]]
=
'
general-
'
+
id
;
icuWithIds
[
generalIds
[
id
]]
=
'
general-
'
+
id
;
}
}
// start with all views, and remove localized ones as they are iterated over
var
nonLocalizedViews
=
glob
.
sync
(
path
.
resolve
(
__dirname
,
'
../src/views/*
'
));
for
(
var
i
=
0
;
i
<
nonLocalizedViews
.
length
;
i
++
)
{
nonLocalizedViews
[
i
]
=
nonLocalizedViews
[
i
].
split
(
'
/
'
).
pop
();
}
// get view-specific locale strings.
// get view-specific locale strings.
var
files
=
glob
.
sync
(
path
.
resolve
(
__dirname
,
'
../src/views/**/l10n.json
'
));
var
files
=
glob
.
sync
(
path
.
resolve
(
__dirname
,
'
../src/views/**/l10n.json
'
));
files
.
forEach
(
function
(
file
)
{
files
.
forEach
(
function
(
file
)
{
var
dirPath
=
file
.
split
(
'
/
'
);
var
dirPath
=
file
.
split
(
'
/
'
);
dirPath
.
pop
();
dirPath
.
pop
();
var
view
=
dirPath
.
pop
();
var
view
=
dirPath
.
pop
();
if
(
nonLocalizedViews
.
indexOf
(
view
)
>
-
1
)
{
nonLocalizedViews
.
splice
(
nonLocalizedViews
.
indexOf
(
view
),
1
);
}
var
viewIds
=
JSON
.
parse
(
fs
.
readFileSync
(
file
,
'
utf8
'
));
var
viewIds
=
JSON
.
parse
(
fs
.
readFileSync
(
file
,
'
utf8
'
));
viewLocales
[
view
]
=
{
viewLocales
[
view
]
=
{
...
@@ -158,4 +167,11 @@ glob(poUiDir + '/*', function (err, files) {
...
@@ -158,4 +167,11 @@ glob(poUiDir + '/*', function (err, files) {
var
fileString
=
'
window._messages =
'
+
objectString
+
'
;
'
;
var
fileString
=
'
window._messages =
'
+
objectString
+
'
;
'
;
fs
.
writeFileSync
(
outputDir
+
'
/
'
+
view
+
'
.intl.js
'
,
fileString
);
fs
.
writeFileSync
(
outputDir
+
'
/
'
+
view
+
'
.intl.js
'
,
fileString
);
}
}
// Add general localization strings for non localized views, to account for nav/footer.
for
(
var
i
in
nonLocalizedViews
)
{
objectString
=
JSON
.
stringify
(
generalLocales
);
fileString
=
'
window._messages =
'
+
objectString
+
'
;
'
;
fs
.
writeFileSync
(
outputDir
+
'
/
'
+
nonLocalizedViews
[
i
]
+
'
.intl.js
'
,
fileString
);
}
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment