-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See translate/l10n-guide#22 Signed-off-by: Michal Čihař <[email protected]>
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#! /usr/bin/env python3 | ||
|
||
# Export Gettext builtin plurals | ||
|
||
import re | ||
from urllib.request import urlopen | ||
|
||
URL = 'http://git.savannah.gnu.org/cgit/gettext.git/plain/gettext-tools/src/plural-table.c' | ||
MATCH = re.compile(r'\s*{\s*"([^"]*)",\s*"([^"]*)",\s*"([^"]*)"\s*},\s*') | ||
|
||
with urlopen(URL) as handle: | ||
content = handle.read().decode('utf-8') | ||
|
||
output = [] | ||
state = 0 | ||
for line in content.splitlines(): | ||
if 'plural_table' in line: | ||
state = 1 | ||
continue | ||
if state == 1: | ||
matches = MATCH.match(line) | ||
if matches: | ||
output.append('{};{};{};{}\n'.format( | ||
matches[1], | ||
matches[2], | ||
int(matches[3].split(';', 1)[0].split('=')[1]), | ||
matches[3].split(';', 1)[1].split('=', 1)[1].rstrip(';'), | ||
)) | ||
|
||
with open('gettext.csv', 'w') as handle: | ||
handle.writelines(sorted(output)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
be;Belarusian;3;(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2) | ||
bg;Bulgarian;2;(n != 1) | ||
cs;Czech;3;(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2 | ||
da;Danish;2;(n != 1) | ||
de;German;2;(n != 1) | ||
el;Greek;2;(n != 1) | ||
en;English;2;(n != 1) | ||
eo;Esperanto;2;(n != 1) | ||
es;Spanish;2;(n != 1) | ||
et;Estonian;2;(n != 1) | ||
fi;Finnish;2;(n != 1) | ||
fo;Faroese;2;(n != 1) | ||
fr;French;2;(n > 1) | ||
ga;Irish;3;n==1 ? 0 : n==2 ? 1 : 2 | ||
he;Hebrew;2;(n != 1) | ||
hr;Croatian;3;(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2) | ||
hu;Hungarian;2;(n != 1) | ||
it;Italian;2;(n != 1) | ||
ja;Japanese;1;0 | ||
ko;Korean;1;0 | ||
lt;Lithuanian;3;(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2) | ||
lv;Latvian;3;(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2) | ||
nb;Norwegian Bokmal;2;(n != 1) | ||
nl;Dutch;2;(n != 1) | ||
nn;Norwegian Nynorsk;2;(n != 1) | ||
no;Norwegian;2;(n != 1) | ||
pl;Polish;3;(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2) | ||
pt;Portuguese;2;(n != 1) | ||
pt_BR;Brazilian;2;(n > 1) | ||
ro;Romanian;3;n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2 | ||
ru;Russian;3;(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2) | ||
sk;Slovak;3;(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2 | ||
sr;Serbian;3;(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2) | ||
sv;Swedish;2;(n != 1) | ||
tr;Turkish;2;(n != 1) | ||
uk;Ukrainian;3;(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2) | ||
vi;Vietnamese;1;0 |