Skip to content

Add Internationalization section with gettext-tstrings - #14

Merged
koxudaxi merged 1 commit into
t-strings:mainfrom
yhay81:add-i18n-gettext-tstrings
Jul 31, 2026
Merged

koxudaxi merged 1 commit into
t-strings:mainfrom
yhay81:add-i18n-gettext-tstrings

Conversation

@yhay81

@yhay81 yhay81 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Adds a new Internationalization subsection under Libraries & Frameworks — the list currently has no i18n entry.

gettext-tstrings bridges t-strings to the existing gettext/Babel ecosystem: _(t"Hello {name}") sends the full sentence Hello {name} to a standard PO/MO catalog, translators can reorder or repeat placeholders, and attribute access / calls / translation-side format specs are rejected. Extraction and catalog validation work with unmodified pybabel via entry points. The t-string→msgid convention is specified in a versioned SPEC.md.

Checked against CONTRIBUTING.md:

  • No duplicate: searched the list and found no existing i18n/gettext entry (proposed a new category, alphabetically placed between HTML and Utilities, TOC updated).
  • Working example, tested on Python 3.14.6:
import gettext
from gettext_tstrings import Translator

_ = Translator(gettext.translation("messages", localedir="locales", languages=["ja"]))
name = "Ada"
print(_(t"Hello {name}"))  # → "Adaさん、こんにちは" (translation may reorder {name})
  • Links verified: repo, PyPI (pip install gettext-tstrings, v0.1.0a2), MIT licensed, CI on Linux/macOS/Windows.

@koxudaxi
koxudaxi merged commit cd39c6e into t-strings:main Jul 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants