Translate the library's own text, in its own gettext domain

Everything the library speaks or shows itself is marked for
translation in a libstormgames domain, separate from any game's, so
one translation serves every game: the text box, the text window,
speech history, game_menu's own items, learn_sounds, instructions,
credits, donate and the high scores. Sentences built from pieces are
whole sentences with named placeholders now, such as
"{character} deleted".

set_language(code) chooses the language, so a game that lets players
pick one can make the library speak it too; with no call it follows
the system, and falls back to English. Translations go in
locales/<language>/LC_MESSAGES/libstormgames.po, and
tools/update-translations.sh extracts the text into
locales/libstormgames.pot and compiles them.

The text box now names symbols when moving over or deleting them, as
it already did when typing, and get_input's default prompt is
translated. Game.display_text no longer drops the first and last
lines when Space reads them all or T copies them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Storm DragonandClaude Opus 5.5 committed 2026-11-24 00:10:19 -05:00
1 parent 3619c6720b
commit 80ddfdcd34
11 files changed
+683 -147

No files matched your search

+400
View File
@@ -0,0 +1,400 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the libstormgames package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: libstormgames\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-24 00:01-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: display.py:170 utils.py:260
msgid ""
"Press space to read the whole text. Use up and down arrows to navigate the "
"text line by line. Press c to copy the current line to the clipboard or t to "
"copy the entire text. Press enter or escape when you are done reading."
msgstr ""
#: display.py:177 utils.py:267
msgid "End of text."
msgstr ""
#: display.py:225 utils.py:313
#, python-brace-format
msgid "Copied {text} to the clipboard."
msgstr ""
#: display.py:227 display.py:235 utils.py:315 utils.py:324
msgid "Failed to copy the text to the clipboard."
msgstr ""
#: display.py:233 utils.py:322
msgid "Copied entire message to the clipboard."
msgstr ""
#: input.py:18
msgid "space"
msgstr ""
#: input.py:19
msgid "backslash"
msgstr ""
#: input.py:20
msgid "slash"
msgstr ""
#: input.py:21
msgid "exclamation mark"
msgstr ""
#: input.py:22
msgid "quotation mark"
msgstr ""
#: input.py:23
msgid "hash"
msgstr ""
#: input.py:24
msgid "dollar sign"
msgstr ""
#: input.py:25
msgid "percent"
msgstr ""
#: input.py:26
msgid "ampersand"
msgstr ""
#: input.py:27
msgid "apostrophe"
msgstr ""
#: input.py:28
msgid "left parenthesis"
msgstr ""
#: input.py:29
msgid "right parenthesis"
msgstr ""
#: input.py:30
msgid "asterisk"
msgstr ""
#: input.py:31
msgid "plus"
msgstr ""
#: input.py:32
msgid "comma"
msgstr ""
#: input.py:33
msgid "minus"
msgstr ""
#: input.py:34
msgid "period"
msgstr ""
#: input.py:35
msgid "colon"
msgstr ""
#: input.py:36
msgid "semicolon"
msgstr ""
#: input.py:37
msgid "less than"
msgstr ""
#: input.py:38
msgid "equals"
msgstr ""
#: input.py:39
msgid "greater than"
msgstr ""
#: input.py:40
msgid "question mark"
msgstr ""
#: input.py:41
msgid "at sign"
msgstr ""
#: input.py:42
msgid "left bracket"
msgstr ""
#: input.py:43
msgid "right bracket"
msgstr ""
#: input.py:44
msgid "caret"
msgstr ""
#: input.py:45
msgid "underscore"
msgstr ""
#: input.py:46
msgid "grave accent"
msgstr ""
#: input.py:47
msgid "left brace"
msgstr ""
#: input.py:48
msgid "pipe"
msgstr ""
#: input.py:49
msgid "right brace"
msgstr ""
#: input.py:50
msgid "tilde"
msgstr ""
#: input.py:78
msgid "Enter text:"
msgstr ""
#: input.py:86
#, python-brace-format
msgid "{count} character"
msgid_plural "{count} characters"
msgstr[0] ""
msgstr[1] ""
#: input.py:90
#, python-brace-format
msgid "{prompt} Password field, {length}"
msgstr ""
#: input.py:92
#, python-brace-format
msgid "{prompt} Default text: {text}"
msgstr ""
#: input.py:94
#, python-brace-format
msgid "{prompt} Empty password field"
msgstr ""
#: input.py:96
#, python-brace-format
msgid "{prompt} Empty text field"
msgstr ""
#: input.py:111
msgid "Submitted"
msgstr ""
#: input.py:111 input.py:115
msgid "Submitted: empty"
msgstr ""
#: input.py:113
#, python-brace-format
msgid "Submitted: {text}"
msgstr ""
#: input.py:120
msgid "Cancelled"
msgstr ""
#: input.py:128 input.py:136
msgid "star deleted"
msgstr ""
#: input.py:128 input.py:136
#, python-brace-format
msgid "{character} deleted"
msgstr ""
#: input.py:130 input.py:138
msgid "Nothing to delete"
msgstr ""
#: input.py:145 input.py:149 input.py:173
msgid "Beginning of text"
msgstr ""
#: input.py:147 input.py:154 input.py:193
msgid "star"
msgstr ""
#: input.py:157 input.py:159 input.py:178
msgid "End of text"
msgstr ""
#: input.py:168
msgid "Empty text field"
msgstr ""
#: input.py:205
msgid "Game paused, press backspace to resume."
msgstr ""
#: menu.py:32
msgid "play"
msgstr ""
#: menu.py:33
msgid "high scores"
msgstr ""
#: menu.py:34
msgid "learn sounds"
msgstr ""
#: menu.py:35
msgid "instructions"
msgstr ""
#: menu.py:36
msgid "credits"
msgstr ""
#: menu.py:37
msgid "donate"
msgstr ""
#: menu.py:38
msgid "exit game"
msgstr ""
#: menu.py:448
msgid "No sounds available to learn."
msgstr ""
#: menu.py:463
msgid ""
"Starting with root directory sounds. Use left and right arrows or page up "
"and page down to navigate categories."
msgstr ""
#: menu.py:466
#, python-brace-format
msgid ""
"Starting with {category} sounds. Use left and right arrows or page up and "
"page down to navigate categories."
msgstr ""
#. Translators: a sound's name and what it is, as in "bell: the lap bell".
#: menu.py:493
#, python-brace-format
msgid "{sound}: {description}"
msgstr ""
#: menu.py:499
#, python-brace-format
msgid "Root directory: {sound}, {number} of {total}"
msgstr ""
#: menu.py:502
#, python-brace-format
msgid "{category}: {sound}, {number} of {total}"
msgstr ""
#: menu.py:506
#, python-brace-format
msgid "{sound}, {number} of {total}"
msgstr ""
#: menu.py:553
msgid "Could not play sound."
msgstr ""
#: menu.py:571
msgid "Instructions file is missing."
msgstr ""
#: menu.py:589
msgid "Credits file is missing."
msgstr ""
#: menu.py:599
msgid "The donation page has been opened in your browser."
msgstr ""
#: scoreboard.py:170
msgid "New high score! Enter your name:"
msgstr ""
#: scoreboard.py:172
msgid "Player"
msgstr ""
#: scoreboard.py:211 scoreboard.py:215
#, python-brace-format
msgid "Congratulations {name}! You got position {position} on the scoreboard!"
msgstr ""
#: scoreboard.py:315
#, python-brace-format
msgid "High Scores for {game}:"
msgstr ""
#. Translators: one line of the high scores, as in "1. Username: 500".
#: scoreboard.py:321
#, python-brace-format
msgid "{place}. {name}: {score}"
msgstr ""
#: scoreboard.py:324
msgid "No high scores yet."
msgstr ""
#: scoreboard.py:330
msgid "Could not display high scores."
msgstr ""
#: speech.py:304 speech.py:311
msgid "Press any key to repeat or enter to continue."
msgstr ""
#: speech.py:470
#, python-brace-format
msgid "First: {message}"
msgstr ""
#: speech.py:473
msgid "No previous messages"
msgstr ""
#: speech.py:475 speech.py:489 speech.py:506
msgid "Speech history not available"
msgstr ""
#: speech.py:487
msgid "No messages in history"
msgstr ""
#: speech.py:501
#, python-brace-format
msgid "Last: {message}"
msgstr ""
#: speech.py:504
msgid "No next messages"
msgstr ""