Skip to content

Commit

Permalink
refactor: rethink i18n function names
Browse files Browse the repository at this point in the history
  • Loading branch information
MHajoha committed Mar 4, 2025
1 parent 12cb709 commit d8c8536
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 119 deletions.
53 changes: 29 additions & 24 deletions examples/i18n/locale/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: @local/i18n 0.1.0\n"
"Report-Msgid-Bugs-To: Jane Doe <[email protected]>\n"
"POT-Creation-Date: 2025-02-24 15:42+0100\n"
"PO-Revision-Date: 2025-02-24 15:56+0100\n"
"POT-Creation-Date: 2025-03-04 17:05+0100\n"
"PO-Revision-Date: 2025-03-04 17:40+0100\n"
"Last-Translator: \n"
"Language-Team: de <[email protected]>\n"
"Language: de\n"
Expand All @@ -20,101 +20,103 @@ msgstr ""
"Generated-By: Babel 2.17.0\n"
"X-Generator: Poedit 3.5\n"

#: python/local/i18n/__init__.py:14
#: python/local/i18n/__init__.py:11
msgid "I'm marked using a no-op function and later dynamically translated."
msgstr ""
"Ich bin mit einer no-op-Funktion markiert und werde später dynamisch "
"übersetzt."

#: python/local/i18n/__init__.py:15
msgid "Status of the file"
msgstr "Status der Datei"

#: python/local/i18n/__init__.py:14
#: python/local/i18n/__init__.py:15
msgctxt "File"
msgid "Opened"
msgstr "Geöffnet"

#: python/local/i18n/__init__.py:16
#: python/local/i18n/__init__.py:17
msgid "Status of the amusement park"
msgstr "Status des Freizeitparks"

#: python/local/i18n/__init__.py:16
#: python/local/i18n/__init__.py:17
msgctxt "Amusement Park"
msgid "Opened"
msgstr "Eröffnet"

#: python/local/i18n/__init__.py:20
#: python/local/i18n/__init__.py:21
msgid "npgettext combines pluralization support and contextualization."
msgstr "npgettext erlaubt sowohl Pluralisierung als auch Kontextualisierung."

#: python/local/i18n/__init__.py:21
#: python/local/i18n/__init__.py:22
#, python-brace-format
msgctxt "Home Depot"
msgid "There is a light."
msgid_plural "There are {} lights!"
msgstr[0] "Da ist eine Lampe."
msgstr[1] "Da sind {} Lampen!"

#: python/local/i18n/__init__.py:23
#: python/local/i18n/__init__.py:24
#, python-brace-format
msgctxt "Picard"
msgid "There is a light."
msgid_plural "There are {} lights!"
msgstr[0] "Da ist ein Licht."
msgstr[1] "Da sind {} Lichter!"

#: python/local/i18n/__init__.py:27
#: python/local/i18n/__init__.py:28
msgid "First Option"
msgstr "Erste Option"

#: python/local/i18n/__init__.py:28
#: python/local/i18n/__init__.py:29
msgid "Second Option"
msgstr "Zweite Option"

#: python/local/i18n/__init__.py:29
#: python/local/i18n/__init__.py:30
msgid "Third Option"
msgstr "Dritte Option"

#. This comment will be shown in the .pot file.
#: python/local/i18n/__init__.py:35
#: python/local/i18n/__init__.py:36
msgid "This is a localized FormModel."
msgstr "Das ist ein lokalisiertes FormModel."

#: python/local/i18n/__init__.py:36
#: python/local/i18n/__init__.py:37
msgid ""
"The FormModel is defined before any initialization, so message translation "
"needs to be deferred!"
msgstr ""
"Das FormModel wird vor jeder Initialisierung definiert, deshalb müssen "
"Übersetzungen später geschehen!"

#: python/local/i18n/__init__.py:40
#: python/local/i18n/__init__.py:41
msgid "This is a text_input, and its label is localized!"
msgstr "Das ist ein text_input, und sein Label ist lokalisiert!"

#: python/local/i18n/__init__.py:42
#: python/local/i18n/__init__.py:43
msgid "Even this placeholder is localized!"
msgstr "Selbst dieser Platzhalter ist lokalisiert!"

#: python/local/i18n/__init__.py:43
#: python/local/i18n/__init__.py:44
msgid "Now you can get help in your language!"
msgstr "Jetzt kannst du in deiner Sprache Hilfe erhalten!"

#: python/local/i18n/__init__.py:47
#: python/local/i18n/__init__.py:48
#, python-brace-format
msgid "Choose exactly one option."
msgid_plural "Choose exactly {} options."
msgstr[0] "Wähle genau eine Option."
msgstr[1] "Wähle genau {} Optionen."

#: python/local/i18n/__init__.py:50
#: python/local/i18n/__init__.py:51
msgid "This section shows contextualized messages."
msgstr "Dieser Abschnitt zeigt kontextualisierte Übersetzungen."

#: python/local/i18n/__init__.py:63
#: python/local/i18n/__init__.py:64
msgid "Programmatic translation!"
msgstr "Programmatische Übersetzung!"

#. This comment will be shown in the .pot file.
#: templates/formulation.xhtml.j2:4
msgid "This string should be localized!"
msgstr "Diese Zeichenkette sollte lokalisiert sein!"

#: templates/formulation.xhtml.j2:5
msgid "One Thing"
msgid_plural "More Things"
Expand Down Expand Up @@ -144,3 +146,6 @@ msgid "One Thing"
msgid_plural "More Things"
msgstr[0] "Eine Sache in Kontext 2"
msgstr[1] "Mehrere Sachen in Kontext 2"

#~ msgid "This string should be localized!"
#~ msgstr "Diese Zeichenkette sollte lokalisiert sein!"
57 changes: 28 additions & 29 deletions examples/i18n/locale/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,110 +8,111 @@ msgid ""
msgstr ""
"Project-Id-Version: @local/i18n 0.1.0\n"
"Report-Msgid-Bugs-To: Jane Doe <[email protected]>\n"
"POT-Creation-Date: 2025-02-24 15:42+0100\n"
"PO-Revision-Date: 2025-02-24 15:34+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
"POT-Creation-Date: 2025-03-04 17:05+0100\n"
"PO-Revision-Date: 2025-03-04 17:15+0100\n"
"Last-Translator: \n"
"Language-Team: en <[email protected]>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: Babel 2.17.0\n"
"X-Generator: Poedit 3.5\n"

#: python/local/i18n/__init__.py:14
#: python/local/i18n/__init__.py:11
msgid "I'm marked using a no-op function and later dynamically translated."
msgstr ""

#: python/local/i18n/__init__.py:15
msgid "Status of the file"
msgstr ""

#: python/local/i18n/__init__.py:14
#: python/local/i18n/__init__.py:15
msgctxt "File"
msgid "Opened"
msgstr ""

#: python/local/i18n/__init__.py:16
#: python/local/i18n/__init__.py:17
msgid "Status of the amusement park"
msgstr ""

#: python/local/i18n/__init__.py:16
#: python/local/i18n/__init__.py:17
msgctxt "Amusement Park"
msgid "Opened"
msgstr ""

#: python/local/i18n/__init__.py:20
#: python/local/i18n/__init__.py:21
msgid "npgettext combines pluralization support and contextualization."
msgstr ""

#: python/local/i18n/__init__.py:21
#: python/local/i18n/__init__.py:22
#, python-brace-format
msgctxt "Home Depot"
msgid "There is a light."
msgid_plural "There are {} lights!"
msgstr[0] ""
msgstr[1] ""

#: python/local/i18n/__init__.py:23
#: python/local/i18n/__init__.py:24
#, python-brace-format
msgctxt "Picard"
msgid "There is a light."
msgid_plural "There are {} lights!"
msgstr[0] ""
msgstr[1] ""

#: python/local/i18n/__init__.py:27
#: python/local/i18n/__init__.py:28
msgid "First Option"
msgstr ""

#: python/local/i18n/__init__.py:28
#: python/local/i18n/__init__.py:29
msgid "Second Option"
msgstr ""

#: python/local/i18n/__init__.py:29
#: python/local/i18n/__init__.py:30
msgid "Third Option"
msgstr ""

#. This comment will be shown in the .pot file.
#: python/local/i18n/__init__.py:35
#: python/local/i18n/__init__.py:36
msgid "This is a localized FormModel."
msgstr ""

#: python/local/i18n/__init__.py:36
#: python/local/i18n/__init__.py:37
msgid ""
"The FormModel is defined before any initialization, so message "
"translation needs to be deferred!"
msgstr ""

#: python/local/i18n/__init__.py:40
#: python/local/i18n/__init__.py:41
msgid "This is a text_input, and its label is localized!"
msgstr ""

#: python/local/i18n/__init__.py:42
#: python/local/i18n/__init__.py:43
msgid "Even this placeholder is localized!"
msgstr ""

#: python/local/i18n/__init__.py:43
#: python/local/i18n/__init__.py:44
msgid "Now you can get help in your language!"
msgstr ""

#: python/local/i18n/__init__.py:47
#: python/local/i18n/__init__.py:48
#, python-brace-format
msgid "Choose exactly one option."
msgid_plural "Choose exactly {} options."
msgstr[0] ""
msgstr[1] ""

#: python/local/i18n/__init__.py:50
#: python/local/i18n/__init__.py:51
msgid "This section shows contextualized messages."
msgstr ""

#: python/local/i18n/__init__.py:63
#: python/local/i18n/__init__.py:64
msgid "Programmatic translation!"
msgstr ""

#. This comment will be shown in the .pot file.
#: templates/formulation.xhtml.j2:4
msgid "This string should be localized!"
msgstr ""

#: templates/formulation.xhtml.j2:5
msgid "One Thing"
msgid_plural "More Things"
Expand All @@ -129,15 +130,13 @@ msgid "My Message"
msgstr ""

#: templates/formulation.xhtml.j2:10 templates/formulation.xhtml.j2:11
#, fuzzy
msgctxt "Context 1"
msgid "One Thing"
msgid_plural "More Things"
msgstr[0] ""
msgstr[1] ""

#: templates/formulation.xhtml.j2:12 templates/formulation.xhtml.j2:13
#, fuzzy
msgctxt "Context 2"
msgid "One Thing"
msgid_plural "More Things"
Expand Down
Loading

0 comments on commit d8c8536

Please sign in to comment.