Skip to content

Commit cd46239

Browse files
author
Josef Fröhle
committed
Create MO parser
Refactored a bit too, so we can use interfaces to take Mo and Po files added fixtures found that the parser for Po files have a bug... but it works... so not touched
1 parent 8c36835 commit cd46239

23 files changed

+1726
-234
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
.settings
44
.buildpath
55

6+
# golang jetbrains shit
7+
.idea
8+
69
# Compiled Object files, Static and Dynamic libs (Shared Objects)
710
*.o
811
*.a

fixtures/de/default.mo

1.17 KB
Binary file not shown.

fixtures/de/default.po

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
msgid ""
2+
msgstr ""
3+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
4+
"Project-Id-Version: \n"
5+
"POT-Creation-Date: \n"
6+
"PO-Revision-Date: \n"
7+
"Last-Translator: Josef Fröhle <[email protected]>\n"
8+
"Language-Team: \n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"Language: de\n"
13+
"X-Generator: Poedit 2.0.6\n"
14+
"X-Poedit-SourceCharset: UTF-8\n"
15+
16+
# Initial comment
17+
# Headers below
18+
msgid "language"
19+
msgstr "de"
20+
21+
# Some comment
22+
msgid "My text"
23+
msgstr "Translated text"
24+
25+
# More comments
26+
msgid "Another string"
27+
msgstr ""
28+
29+
# Multi-line msgid
30+
msgid ""
31+
"multi\n"
32+
"line\n"
33+
"id"
34+
msgstr "id with multiline content"
35+
36+
# Multi-line msgid_plural
37+
msgid ""
38+
"multi\n"
39+
"line\n"
40+
"plural\n"
41+
"id"
42+
msgstr "plural id with multiline content"
43+
44+
# Multi-line string
45+
msgid "Multi-line"
46+
msgstr ""
47+
"Multi \n"
48+
"line"
49+
50+
msgid "One with var: %s"
51+
msgid_plural "Several with vars: %s"
52+
msgstr[0] "This one is the singular: %s"
53+
msgstr[1] "This one is the plural: %s"
54+
55+
msgctxt "Ctx"
56+
msgid "One with var: %s"
57+
msgid_plural "Several with vars: %s"
58+
msgstr[0] "This one is the singular in a Ctx context: %s"
59+
msgstr[1] "This one is the plural in a Ctx context: %s"
60+
61+
msgid "Some random"
62+
msgstr "Some random translation"
63+
64+
msgctxt "Ctx"
65+
msgid "Some random in a context"
66+
msgstr "Some random translation in a context"
67+
68+
msgid "Empty translation"
69+
msgstr ""
70+
71+
msgid "Empty plural form singular"
72+
msgid_plural "Empty plural form"
73+
msgstr[0] "Singular translated"
74+
msgstr[1] ""
75+
76+
msgid "More"
77+
msgstr "More translation"

fixtures/de_DE/LC_MESSAGES/default.mo

1.17 KB
Binary file not shown.

fixtures/de_DE/LC_MESSAGES/default.po

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
msgid ""
2+
msgstr ""
3+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
4+
"Project-Id-Version: \n"
5+
"POT-Creation-Date: \n"
6+
"PO-Revision-Date: \n"
7+
"Last-Translator: Josef Fröhle <[email protected]>\n"
8+
"Language-Team: \n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"Language: de_DE\n"
13+
"X-Generator: Poedit 2.0.6\n"
14+
"X-Poedit-SourceCharset: UTF-8\n"
15+
16+
# Initial comment
17+
# Headers below
18+
msgid "language"
19+
msgstr "de_DE"
20+
21+
# Some comment
22+
msgid "My text"
23+
msgstr "Translated text"
24+
25+
# More comments
26+
msgid "Another string"
27+
msgstr ""
28+
29+
# Multi-line msgid
30+
msgid ""
31+
"multi\n"
32+
"line\n"
33+
"id"
34+
msgstr "id with multiline content"
35+
36+
# Multi-line msgid_plural
37+
msgid ""
38+
"multi\n"
39+
"line\n"
40+
"plural\n"
41+
"id"
42+
msgstr "plural id with multiline content"
43+
44+
# Multi-line string
45+
msgid "Multi-line"
46+
msgstr ""
47+
"Multi \n"
48+
"line"
49+
50+
msgid "One with var: %s"
51+
msgid_plural "Several with vars: %s"
52+
msgstr[0] "This one is the singular: %s"
53+
msgstr[1] "This one is the plural: %s"
54+
55+
msgctxt "Ctx"
56+
msgid "One with var: %s"
57+
msgid_plural "Several with vars: %s"
58+
msgstr[0] "This one is the singular in a Ctx context: %s"
59+
msgstr[1] "This one is the plural in a Ctx context: %s"
60+
61+
msgid "Some random"
62+
msgstr "Some random translation"
63+
64+
msgctxt "Ctx"
65+
msgid "Some random in a context"
66+
msgstr "Some random translation in a context"
67+
68+
msgid "Empty translation"
69+
msgstr ""
70+
71+
msgid "Empty plural form singular"
72+
msgid_plural "Empty plural form"
73+
msgstr[0] "Singular translated"
74+
msgstr[1] ""
75+
76+
msgid "More"
77+
msgstr "More translation"

fixtures/en_AU/default.po

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
msgid ""
2+
msgstr ""
3+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
4+
"Project-Id-Version: \n"
5+
"POT-Creation-Date: \n"
6+
"PO-Revision-Date: \n"
7+
"Last-Translator: Josef Fröhle <[email protected]>\n"
8+
"Language-Team: \n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"Language: en_US\n"
13+
"X-Generator: Poedit 2.0.6\n"
14+
"X-Poedit-SourceCharset: UTF-8\n"
15+
16+
# Initial comment
17+
# Headers below
18+
msgid "language"
19+
msgstr "en_AU"
20+
21+
# Some comment
22+
msgid "My text"
23+
msgstr "Translated text"
24+
25+
# More comments
26+
msgid "Another string"
27+
msgstr ""
28+
29+
# Multi-line msgid
30+
msgid "multilineid"
31+
msgstr "id with multiline content"
32+
33+
# Multi-line msgid_plural
34+
msgid "multilinepluralid"
35+
msgstr "plural id with multiline content"
36+
37+
# Multi-line string
38+
msgid "Multi-line"
39+
msgstr "Multi line"
40+
41+
msgid "One with var: %s"
42+
msgid_plural "Several with vars: %s"
43+
msgstr[0] "This one is the singular: %s"
44+
msgstr[1] "This one is the plural: %s"
45+
46+
msgctxt "Ctx"
47+
msgid "One with var: %s"
48+
msgid_plural "Several with vars: %s"
49+
msgstr[0] "This one is the singular in a Ctx context: %s"
50+
msgstr[1] "This one is the plural in a Ctx context: %s"
51+
52+
msgid "Some random"
53+
msgstr "Some random translation"
54+
55+
msgctxt "Ctx"
56+
msgid "Some random in a context"
57+
msgstr "Some random translation in a context"
58+
59+
msgid "Empty translation"
60+
msgstr ""
61+
62+
msgid "Empty plural form singular"
63+
msgid_plural "Empty plural form"
64+
msgstr[0] "Singular translated"
65+
msgstr[1] ""
66+
67+
msgid "More"
68+
msgstr "More translation"

fixtures/en_GB/default.mo

1.17 KB
Binary file not shown.

fixtures/en_US/default.mo

1.17 KB
Binary file not shown.

fixtures/en_US/default.po

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
msgid ""
2+
msgstr ""
3+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
4+
"Project-Id-Version: \n"
5+
"POT-Creation-Date: \n"
6+
"PO-Revision-Date: \n"
7+
"Last-Translator: Josef Fröhle <[email protected]>\n"
8+
"Language-Team: \n"
9+
"MIME-Version: 1.0\n"
10+
"Content-Type: text/plain; charset=UTF-8\n"
11+
"Content-Transfer-Encoding: 8bit\n"
12+
"Language: en_US\n"
13+
"X-Generator: Poedit 2.0.6\n"
14+
"X-Poedit-SourceCharset: UTF-8\n"
15+
16+
# Initial comment
17+
# Headers below
18+
msgid "language"
19+
msgstr "en_US"
20+
21+
# Some comment
22+
msgid "My text"
23+
msgstr "Translated text"
24+
25+
# More comments
26+
msgid "Another string"
27+
msgstr ""
28+
29+
# Multi-line msgid
30+
msgid "multilineid"
31+
msgstr "id with multiline content"
32+
33+
# Multi-line msgid_plural
34+
msgid "multilinepluralid"
35+
msgstr "plural id with multiline content"
36+
37+
# Multi-line string
38+
msgid "Multi-line"
39+
msgstr "Multi line"
40+
41+
msgid "One with var: %s"
42+
msgid_plural "Several with vars: %s"
43+
msgstr[0] "This one is the singular: %s"
44+
msgstr[1] "This one is the plural: %s"
45+
46+
msgctxt "Ctx"
47+
msgid "One with var: %s"
48+
msgid_plural "Several with vars: %s"
49+
msgstr[0] "This one is the singular in a Ctx context: %s"
50+
msgstr[1] "This one is the plural in a Ctx context: %s"
51+
52+
msgid "Some random"
53+
msgstr "Some random translation"
54+
55+
msgctxt "Ctx"
56+
msgid "Some random in a context"
57+
msgstr "Some random translation in a context"
58+
59+
msgid "Empty translation"
60+
msgstr ""
61+
62+
msgid "Empty plural form singular"
63+
msgid_plural "Empty plural form"
64+
msgstr[0] "Singular translated"
65+
msgstr[1] ""
66+
67+
msgid "More"
68+
msgstr "More translation"

fixtures/fr/LC_MESSAGES/default.mo

1.17 KB
Binary file not shown.

0 commit comments

Comments
 (0)