implement plurals, update de_DE translation to use plurals

This commit is contained in:
Jannes Höke
2016-05-24 15:49:23 +02:00
parent c54ffd83e5
commit 6901e7f4d0
10 changed files with 410 additions and 233 deletions

View File

@ -0,0 +1,21 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from .available import available_locales

37
locales/available.py Normal file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Defines a dict of all available locales to the language name"""
OFFSET = 127462 - ord('A')
def flag(code):
return chr(ord(code[0]) + OFFSET) + chr(ord(code[1]) + OFFSET)
available_locales = {'en_US': flag('US') + ' English (US)',
'de_DE': flag('DE') + ' Deutsch (DE)',
'es_ES': flag('ES') + ' Español (ES)',
'id_ID': flag('ID') + ' Bahasa Indonesia',
'it_IT': flag('IT') + ' Italiano',
'pt_BR': flag('BR') + ' Português Brasileiro',
'zh_HK': flag('HK') + ' 廣東話',
'zh_TW': flag('TW') + ' 中文(香港)'}

View File

@ -29,7 +29,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: utf-8\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Gtranslator 2.91.6\n"
#: bot.py:60
@ -229,17 +229,22 @@ msgstr "Du spielst kein Spiel in dieser Gruppe."
#: bot.py:400
#, python-format
msgid "Please wait {time} seconds"
msgstr "Bitte warte {time} Sekunden"
msgid "Please wait {time} second"
msgid_plural "Please wait {time} seconds"
msgstr[0] "Bitte warte {time} Sekunde"
msgstr[1] "Bitte warte {time} Sekunden"
#: bot.py:413
#, python-format
msgid ""
"Waiting time to skip this player has been reduced to {time} seconds.\n"
msgid "Waiting time to skip this player has been reduced to {time} second.\n"
"Next player: {name}"
msgstr ""
"Die Wartezeit um diesen Spieler zu überspringen wurde auf {time} Sekunden "
"reduziert.\n"
msgid_plural "Waiting time to skip this player has been reduced to {time} seconds.\n"
"Next player: {name}"
msgstr[0] "Die Wartezeit um diesen Spieler zu überspringen wurde auf {time} "
"Sekunde reduziert.\n"
"Nächster Spieler: {name}"
msgstr[1] "Die Wartezeit um diesen Spieler zu überspringen wurde auf {time} "
"Sekunden reduziert.\n"
"Nächster Spieler: {name}"
#: bot.py:424
@ -313,8 +318,10 @@ msgid "Choose Color"
msgstr "Wähle Farbe"
#: results.py:56
msgid "Cards (tap for game state):"
msgstr "Karten (tippe für Spielinfo):"
msgid "Last card (tap for game state):"
msgid_plural "Cards (tap for game state):"
msgstr[0] "Letzte Karte (tippe für Spielinfo):"
msgstr[1] "Karten (tippe für Spielinfo):"
#: results.py:60 results.py:123 results.py:165
msgid "Current player: {name}"
@ -325,13 +332,17 @@ msgid "Last card: {card}"
msgstr "Letzte Karte: {card}"
#: results.py:62 results.py:125 results.py:168
msgid "Players: {player_list}"
msgstr "Spieler: {player_list}"
msgid "Player: {player_list}"
msgid_plural "Players: {player_list}"
msgstr[0] "Spieler: {player_list}"
msgstr[1] "Spieler: {player_list}"
#: results.py:72
#, python-format
msgid "{name} ({number} cards)"
msgstr "{name} ({number} Karten)"
msgid "{name} ({number} card)"
msgid_plural "{name} ({number} cards)"
msgstr[0] "{name} ({number} Karte)"
msgstr[1] "{name} ({number} Karten)"
#: results.py:81
msgid "You are not playing"
@ -355,11 +366,10 @@ msgstr "Starte das Spiel mit /start"
#: results.py:108
#, python-format
msgid "Drawing 1 card"
msgstr "Zieht 1 Karte"
msgid "Drawing {number} cards"
msgstr "Zieht {number} Karten"
msgid "Drawing {number} card"
msgid_plural "Drawing {number} cards"
msgstr[0] "Ich ziehe {number} Karte"
msgstr[1] "Ich ziehe {number} Karten"
#: results.py:136
msgid "Pass"
@ -413,16 +423,22 @@ msgstr "Du hast die Spiel-Statistiken nicht aktiviert. Aktiviere sie, mit dem "
"/settings-Kommando in einem privaten Chat mit dem Bot."
#: simple_commands.py
msgid "{number} games played"
msgstr "{number} gespielte Spiele"
msgid "{number} game played"
msgid_plural "{number} games played"
msgstr[0] "{number} gespieltes Spiel"
msgstr[1] "{number} gespielte Spiele"
#: simple_commands.py
msgid "{number} first places"
msgstr "{number}x 1. Platz"
msgid "{number} first place"
msgid_plural "{number} first places"
msgstr[0] "{number} mal 1. Platz"
msgstr[1] "{number} mal 1. Platz"
#: simple_commands.py
msgid "{number} cards played"
msgstr "{number} gespielte Karten"
msgid "{number} card played"
msgid_plural "{number} cards played"
msgstr[0] "{number} gespielte Karte"
msgstr[1] "{number} gespielte Karten"
#: utils.py

View File

@ -29,6 +29,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: utf-8\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: bot.py:60
@ -184,14 +185,19 @@ msgstr ""
#: bot.py:400
#, python-format
msgid "Please wait {time} seconds"
msgstr ""
msgid "Please wait {time} second"
msgid_plural "Please wait {time} seconds"
msgstr[0] ""
msgstr[1] ""
#: bot.py:413
#, python-format
msgid "Waiting time to skip this player has been reduced to {time} seconds.\n"
msgid "Waiting time to skip this player has been reduced to {time} second.\n"
"Next player: {name}"
msgstr ""
msgid_plural "Waiting time to skip this player has been reduced to {time} seconds.\n"
"Next player: {name}"
msgstr[0] ""
msgstr[1] ""
#: bot.py:424
#, python-format
@ -256,8 +262,10 @@ msgid "Choose Color"
msgstr ""
#: results.py:56
msgid "Cards (tap for game state):"
msgstr ""
msgid "Last card (tap for game state):"
msgid_plural "Cards (tap for game state):"
msgstr[0] ""
msgstr[1] ""
#: results.py:60 results.py:123 results.py:165
msgid "Current player: {name}"
@ -268,13 +276,17 @@ msgid "Last card: {card}"
msgstr ""
#: results.py:62 results.py:125 results.py:168
msgid "Players: {player_list}"
msgstr ""
msgid "Player: {player_list}"
msgid_plural "Players: {player_list}"
msgstr[0] ""
msgstr[1] ""
#: results.py:72
#, python-format
msgid "{name} ({number} cards)"
msgstr ""
msgid "{name} ({number} card)"
msgid_plural "{name} ({number} cards)"
msgstr[0] ""
msgstr[1] ""
#: results.py:81
msgid "You are not playing"
@ -295,11 +307,10 @@ msgstr ""
#: results.py:108
#, python-format
msgid "Drawing 1 card"
msgstr ""
msgid "Drawing {number} cards"
msgstr ""
msgid "Drawing {number} card"
msgid_plural "Drawing {number} cards"
msgstr[0] ""
msgstr[1] ""
#: results.py:136
msgid "Pass"
@ -352,16 +363,22 @@ msgid "You did not enable statistics. Use /settings in "
msgstr ""
#: simple_commands.py
msgid "{number} games played"
msgstr ""
msgid "{number} game played"
msgid_plural "{number} games played"
msgstr[0] ""
msgstr[1] ""
#: simple_commands.py
msgid "{number} first places"
msgstr ""
msgid "{number} first place"
msgid_plural "{number} first places"
msgstr[0] ""
msgstr[1] ""
#: simple_commands.py
msgid "{number} cards played"
msgstr ""
msgid "{number} card played"
msgid_plural "{number} cards played"
msgstr[0] ""
msgstr[1] ""
#: utils.py