Skip to content

Commit

Permalink
Create MO parser
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Josef Fröhle committed Mar 24, 2018
1 parent 8c36835 commit cd46239
Show file tree
Hide file tree
Showing 23 changed files with 1,726 additions and 234 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
.settings
.buildpath

# golang jetbrains shit
.idea

# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
Expand Down
Binary file added fixtures/de/default.mo
Binary file not shown.
77 changes: 77 additions & 0 deletions fixtures/de/default.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Josef Fröhle <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de\n"
"X-Generator: Poedit 2.0.6\n"
"X-Poedit-SourceCharset: UTF-8\n"

# Initial comment
# Headers below
msgid "language"
msgstr "de"

# Some comment
msgid "My text"
msgstr "Translated text"

# More comments
msgid "Another string"
msgstr ""

# Multi-line msgid
msgid ""
"multi\n"
"line\n"
"id"
msgstr "id with multiline content"

# Multi-line msgid_plural
msgid ""
"multi\n"
"line\n"
"plural\n"
"id"
msgstr "plural id with multiline content"

# Multi-line string
msgid "Multi-line"
msgstr ""
"Multi \n"
"line"

msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular: %s"
msgstr[1] "This one is the plural: %s"

msgctxt "Ctx"
msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular in a Ctx context: %s"
msgstr[1] "This one is the plural in a Ctx context: %s"

msgid "Some random"
msgstr "Some random translation"

msgctxt "Ctx"
msgid "Some random in a context"
msgstr "Some random translation in a context"

msgid "Empty translation"
msgstr ""

msgid "Empty plural form singular"
msgid_plural "Empty plural form"
msgstr[0] "Singular translated"
msgstr[1] ""

msgid "More"
msgstr "More translation"
Binary file added fixtures/de_DE/LC_MESSAGES/default.mo
Binary file not shown.
77 changes: 77 additions & 0 deletions fixtures/de_DE/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Josef Fröhle <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: de_DE\n"
"X-Generator: Poedit 2.0.6\n"
"X-Poedit-SourceCharset: UTF-8\n"

# Initial comment
# Headers below
msgid "language"
msgstr "de_DE"

# Some comment
msgid "My text"
msgstr "Translated text"

# More comments
msgid "Another string"
msgstr ""

# Multi-line msgid
msgid ""
"multi\n"
"line\n"
"id"
msgstr "id with multiline content"

# Multi-line msgid_plural
msgid ""
"multi\n"
"line\n"
"plural\n"
"id"
msgstr "plural id with multiline content"

# Multi-line string
msgid "Multi-line"
msgstr ""
"Multi \n"
"line"

msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular: %s"
msgstr[1] "This one is the plural: %s"

msgctxt "Ctx"
msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular in a Ctx context: %s"
msgstr[1] "This one is the plural in a Ctx context: %s"

msgid "Some random"
msgstr "Some random translation"

msgctxt "Ctx"
msgid "Some random in a context"
msgstr "Some random translation in a context"

msgid "Empty translation"
msgstr ""

msgid "Empty plural form singular"
msgid_plural "Empty plural form"
msgstr[0] "Singular translated"
msgstr[1] ""

msgid "More"
msgstr "More translation"
68 changes: 68 additions & 0 deletions fixtures/en_AU/default.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Josef Fröhle <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en_US\n"
"X-Generator: Poedit 2.0.6\n"
"X-Poedit-SourceCharset: UTF-8\n"

# Initial comment
# Headers below
msgid "language"
msgstr "en_AU"

# Some comment
msgid "My text"
msgstr "Translated text"

# More comments
msgid "Another string"
msgstr ""

# Multi-line msgid
msgid "multilineid"
msgstr "id with multiline content"

# Multi-line msgid_plural
msgid "multilinepluralid"
msgstr "plural id with multiline content"

# Multi-line string
msgid "Multi-line"
msgstr "Multi line"

msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular: %s"
msgstr[1] "This one is the plural: %s"

msgctxt "Ctx"
msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular in a Ctx context: %s"
msgstr[1] "This one is the plural in a Ctx context: %s"

msgid "Some random"
msgstr "Some random translation"

msgctxt "Ctx"
msgid "Some random in a context"
msgstr "Some random translation in a context"

msgid "Empty translation"
msgstr ""

msgid "Empty plural form singular"
msgid_plural "Empty plural form"
msgstr[0] "Singular translated"
msgstr[1] ""

msgid "More"
msgstr "More translation"
Binary file added fixtures/en_GB/default.mo
Binary file not shown.
Binary file added fixtures/en_US/default.mo
Binary file not shown.
68 changes: 68 additions & 0 deletions fixtures/en_US/default.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Josef Fröhle <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en_US\n"
"X-Generator: Poedit 2.0.6\n"
"X-Poedit-SourceCharset: UTF-8\n"

# Initial comment
# Headers below
msgid "language"
msgstr "en_US"

# Some comment
msgid "My text"
msgstr "Translated text"

# More comments
msgid "Another string"
msgstr ""

# Multi-line msgid
msgid "multilineid"
msgstr "id with multiline content"

# Multi-line msgid_plural
msgid "multilinepluralid"
msgstr "plural id with multiline content"

# Multi-line string
msgid "Multi-line"
msgstr "Multi line"

msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular: %s"
msgstr[1] "This one is the plural: %s"

msgctxt "Ctx"
msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular in a Ctx context: %s"
msgstr[1] "This one is the plural in a Ctx context: %s"

msgid "Some random"
msgstr "Some random translation"

msgctxt "Ctx"
msgid "Some random in a context"
msgstr "Some random translation in a context"

msgid "Empty translation"
msgstr ""

msgid "Empty plural form singular"
msgid_plural "Empty plural form"
msgstr[0] "Singular translated"
msgstr[1] ""

msgid "More"
msgstr "More translation"
Binary file added fixtures/fr/LC_MESSAGES/default.mo
Binary file not shown.
77 changes: 77 additions & 0 deletions fixtures/fr/LC_MESSAGES/default.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: Josef Fröhle <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"X-Generator: Poedit 2.0.6\n"
"X-Poedit-SourceCharset: UTF-8\n"

# Initial comment
# Headers below
msgid "language"
msgstr "fr"

# Some comment
msgid "My text"
msgstr "Translated text"

# More comments
msgid "Another string"
msgstr ""

# Multi-line msgid
msgid ""
"multi\n"
"line\n"
"id"
msgstr "id with multiline content"

# Multi-line msgid_plural
msgid ""
"multi\n"
"line\n"
"plural\n"
"id"
msgstr "plural id with multiline content"

# Multi-line string
msgid "Multi-line"
msgstr ""
"Multi \n"
"line"

msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular: %s"
msgstr[1] "This one is the plural: %s"

msgctxt "Ctx"
msgid "One with var: %s"
msgid_plural "Several with vars: %s"
msgstr[0] "This one is the singular in a Ctx context: %s"
msgstr[1] "This one is the plural in a Ctx context: %s"

msgid "Some random"
msgstr "Some random translation"

msgctxt "Ctx"
msgid "Some random in a context"
msgstr "Some random translation in a context"

msgid "Empty translation"
msgstr ""

msgid "Empty plural form singular"
msgid_plural "Empty plural form"
msgstr[0] "Singular translated"
msgstr[1] ""

msgid "More"
msgstr "More translation"
Loading

0 comments on commit cd46239

Please sign in to comment.