Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
framadate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nounous
framadate
Commits
65d8fd96
Commit
65d8fd96
authored
7 years ago
by
Luc Didry
Browse files
Options
Downloads
Patches
Plain Diff
[zanata] Use en translation string if not translated
parent
05e9ea15
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.po2json.sh
+3
-1
3 additions, 1 deletion
.po2json.sh
.renest_json.pl
+16
-2
16 additions, 2 deletions
.renest_json.pl
with
19 additions
and
3 deletions
.po2json.sh
+
3
−
1
View file @
65d8fd96
#!/bin/bash
po2json
-i
po/en.po
-t
locale/en.json
--progress
none
-o
po/default.json
for
i
in
po/
*
.po
do
j
=
$(
echo
$i
|
cut
-d
'.'
-f
1 |
cut
-d
'/'
-f
2
)
po2json
-i
$i
-t
locale/en.json
--progress
none | ./.renest_json.pl
>
po/
$j
.json
mv
po/
$j
.json locale/
done
mv
po/
*
.json locale/
This diff is collapsed.
Click to expand it.
.renest_json.pl
+
16
−
2
View file @
65d8fd96
...
...
@@ -3,10 +3,20 @@ use strict;
use
warnings
;
use
JSON
;
#use Hash::Merge::Simple qw(merge);
my
$json
=
JSON
->
new
->
utf8
->
space_before
(
0
)
->
space_after
(
1
)
->
indent
(
4
)
->
canonical
(
1
);
my
$en_file
=
'
po/default.json
';
my
$en
;
{
open
my
$fh
,
'
<
',
$en_file
or
die
;
local
$/
=
undef
;
$en
=
<
$fh
>
;
close
$fh
;
}
$en
=
$json
->
decode
(
$en
);
my
$new_json
=
{};
my
$old_json
=
'';
...
...
@@ -20,7 +30,11 @@ for my $key (keys %{$old_json}) {
my
$real_key
=
substr
(
$key
,
0
,
$index
++
);
my
$trad_key
=
substr
(
$key
,
$index
);
$new_json
->
{
$real_key
}
->
{
$trad_key
}
=
$old_json
->
{
$key
}
if
$old_json
->
{
$key
};
if
(
$old_json
->
{
$key
})
{
$new_json
->
{
$real_key
}
->
{
$trad_key
}
=
$old_json
->
{
$key
};
}
else
{
$new_json
->
{
$real_key
}
->
{
$trad_key
}
=
$en
->
{
$key
};
}
}
print
$json
->
encode
(
$new_json
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment