Internationalization (French)

This commit is contained in:
adrienmalin 2018-08-02 01:25:43 +02:00 committed by GitHub
parent 69b1994da4
commit aa24a4fcd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 589 additions and 63 deletions

View File

@ -6,7 +6,10 @@ PySudoku v0.2 by Adrien MALINGREY
Sudoku game assistant Sudoku game assistant
Tested on Windows 10 with Python 3.6.3 and Linux Mint 18 with Python 3.5.1 Tested on Windows 10 with Python 3.6.3 and Linux Mint 18 with Python 3.5.1
""" """
try: try:
import gettext
from sys import argv, exit
from tkinter import * from tkinter import *
from tkinter import ttk from tkinter import ttk
from tkinter.filedialog import askopenfilename, asksaveasfilename from tkinter.filedialog import askopenfilename, asksaveasfilename
@ -16,98 +19,106 @@ try:
from os.path import basename, dirname, exists from os.path import basename, dirname, exists
from random import sample, shuffle from random import sample, shuffle
from webbrowser import open as open_web_browser from webbrowser import open as open_web_browser
from sys import argv, exit
from string import digits from string import digits
except ImportError as e: except ImportError as e:
exit(e.msg) exit(e.msg)
# Translation
try:
gettext.find('PySudoku')
translator = gettext.translation('PySudoku', localedir='locale')
except FileNotFoundError:
gettext.install('Translation not found')
else:
translator.install('PySudoku')
# Labels # Labels
APP_TITLE = "PySudoku" APP_TITLE = _("PySudoku")
GRID_LABEL = "Grid" GRID_LABEL = _("Grid")
GENERATE_LABEL = "Generate..." GENERATE_LABEL = _("Generate...")
CREATE_LABEL = "Create" CREATE_LABEL = _("Create")
EDIT_LABEL = "Edit" EDIT_LABEL = _("Edit")
VALIDATE_LABEL = "Validate" VALIDATE_LABEL = _("Validate")
SOLVE_LABEL = "Solve" SOLVE_LABEL = _("Solve")
GAME_LABEL = "Game" GAME_LABEL = _("Game")
LOAD_LABEL = "Load..." LOAD_LABEL = _("Load...")
SAVE_LABEL = "Save..." SAVE_LABEL = _("Save...")
RESTART_LABEL = "Restart..." RESTART_LABEL = _("Restart...")
VIEW_LABEL = "View" VIEW_LABEL = _("View")
THEME_LABEL = "Theme" THEME_LABEL = _("Theme")
SHOW_TIPS_LABEL = "Show tips" SHOW_TIPS_LABEL = _("Show tips")
SHOW_CONFLICTS_LABEL = "Show conflicts" SHOW_CONFLICTS_LABEL = _("Show conflicts")
HELP_LABEL = "?" HELP_LABEL = _("?")
WIKI_LABEL = "Wikipedia" WIKI_LABEL = _("Wikipedia")
ABOUT_LABEL = "About..." ABOUT_LABEL = _("About...")
GENERATE_PROGRESS_BOX_TITLE = "Grid generation" GENERATE_PROGRESS_BOX_TITLE = _("Grid generation")
GENERATE_PROGRESS_BOX_TEXT = "Generating a new grid..." GENERATE_PROGRESS_BOX_TEXT = _("Generating a new grid...")
CLUES_DELETING_PROGRESS_BOX_TEXT = "Deleting clues..." CLUES_DELETING_PROGRESS_BOX_TEXT = _("Deleting clues...")
CANCEL_AUTO_CREATE_BUTTON_TEXT = "Stop" CANCEL_AUTO_CREATE_BUTTON_TEXT = _("Stop")
VALIDATION_PROGRESS_BOX_TITLE = "Grid validation" VALIDATION_PROGRESS_BOX_TITLE = _("Grid validation")
VALIDATION_PROGRESS_BOX_TEXT = "Checking if grid has a unique solution..." VALIDATION_PROGRESS_BOX_TEXT = _("Checking if grid has a solution...")
NO_SOLUTION_MESSAGE_BOX_TITLE = "Can't solve grid" NO_SOLUTION_MESSAGE_BOX_TITLE = _("Can't solve grid")
NO_SOLUTION_MESSAGE_BOX_TEXT = ( NO_SOLUTION_MESSAGE_BOX_TEXT = (
"Some boxes have no solution. " _("Some boxes have no solution. "
"Please correct it." "Please correct it.")
) )
NO_OTHER_SOLUTION_PROGESS_BOX_TEXT = "Checking if grid has other solutions..." NO_OTHER_SOLUTION_PROGESS_BOX_TEXT =_( "Checking if grid has other solutions...")
INCORRECT_GRID_MESSAGE_BOX_TITLE = "Incorrect grid" INCORRECT_GRID_MESSAGE_BOX_TITLE = _("Incorrect grid")
SEVERAL_SOLUTIONS_MESSAGE_BOX_TEXT = "The grid has several solutions." SEVERAL_SOLUTIONS_MESSAGE_BOX_TEXT = _("The grid has several solutions.")
CONFLICTS_MESSAGE_BOX_TEXT = ( CONFLICTS_MESSAGE_BOX_TEXT = (
"Some boxes from the same row, column or region " _("Some boxes from the same row, column or region "
"have same digit. Please correct them." "have same digit. Please correct them.")
) )
SOLVING_PROGRESS_BOX_TITLE = "Solving grid" SOLVING_PROGRESS_BOX_TITLE = _("Solving grid")
CALCULATING_SURE_DIGITS_TEXT = "Calculating sure digits..." CALCULATING_SURE_DIGITS_TEXT = _("Calculating sure digits...")
TESTS_PROGRESS_BOX_TEXT = "Test: {} on {}" TESTS_PROGRESS_BOX_TEXT = _("Test: {} on {}")
NO_SOLUTION_EXCEPTION = ( NO_SOLUTION_EXCEPTION = (
"There are some error. " _("There are some error. "
"Please correct them to solve the grid." "Please correct them to solve the grid.")
) )
CANCEL_EXCEPTION = "Cancelled" CANCEL_EXCEPTION = _("Cancelled")
SOLVED_GRID_MESSAGE_BOX_TITLE = "Congratulations!" SOLVED_GRID_MESSAGE_BOX_TITLE = _("Congratulations!")
SOLVED_GRID_MESSAGE_BOX_TEXT = "The grid is solved." SOLVED_GRID_MESSAGE_BOX_TEXT = _("The grid is solved.")
NB_CLUES_MESSAGE_BOX_TITLE = "Generate a new grid" NB_CLUES_MESSAGE_BOX_TITLE = _("Generate a new grid")
NB_CLUES_INPUT_LABEL = "Please enter minimum number of clues:" NB_CLUES_INPUT_LABEL = _("Please enter minimum number of clues:")
HARDER_LABEL = "← harder" HARDER_LABEL = _("← harder")
EASIER_LABEL = "easier →" EASIER_LABEL = _("easier →")
CANCEL_BUTTON_TEXT = "Cancel" CANCEL_BUTTON_TEXT = _("Cancel")
OK_BUTTON_TEXT = "OK" OK_BUTTON_TEXT = _("OK")
CANCELLED_PROGRESS_BOX_TEXT = "Cancelling..." CANCELLED_PROGRESS_BOX_TEXT = _("Cancelling...")
STOPPING_PROGRESS_BOX_TEXT = "Stopping..." STOPPING_PROGRESS_BOX_TEXT = _("Stopping...")
CONFIRM_ERASE_MESSAGE_BOX_TITLE = "Erase the current game?" CONFIRM_ERASE_MESSAGE_BOX_TITLE = _("Erase current game?")
CONFIRM_ERASE_MESSAGE_BOX_TEXT = "A game is in progress. Do you want to erase it?" CONFIRM_ERASE_MESSAGE_BOX_TEXT = _("A game is in progress. Do you want to erase it?")
OPEN_FILE_MESSAGE_BOX_TITLE = "Open game" OPEN_FILE_MESSAGE_BOX_TITLE = _("Open game")
FILE_TYPE_NAME = "PySudoku game" FILE_TYPE_NAME = _("PySudoku game")
FILE_ERROR_MESSAGE_BOX_TITLE = "File error" FILE_ERROR_MESSAGE_BOX_TITLE = _("File error")
CORRUPTED_FILE_MESSAGE_BOX_TEXT = "The file {} can't be read." CORRUPTED_FILE_MESSAGE_BOX_TEXT = _("The file {} can't be read.")
FILE_NOT_FOUND_MESSAGE_BOX_TEXT = "The file {} can't be found." FILE_NOT_FOUND_MESSAGE_BOX_TEXT = _("The file {} can't be found.")
SAVE_FILE_MESSAGE_BOX_TITLE = "Save game" SAVE_FILE_MESSAGE_BOX_TITLE = _("Save game")
WIKI_URL = "https://en.wikipedia.org/wiki/Sudoku" WIKI_URL = _("https://en.wikipedia.org/wiki/Sudoku")
ABOUT_MESSAGE_BOX_TITLE = "About PySudoku" ABOUT_MESSAGE_BOX_TITLE = _("About PySudoku")
ABOUT_MESSAGE_BOX_TEXT = "Author: Adrien Malingrey\n" "Licence: MIT" ABOUT_MESSAGE_BOX_TEXT = _("Author: Adrien Malingrey\n" "Licence: MIT")
CLOSE_MESSAGE_BOX_TITLE = "Save game?" CLOSE_MESSAGE_BOX_TITLE = _("Save game?")
CLOSE_MESSAGE_BOX_TITLE = "A game is in progress. Would you like to save it?" CLOSE_MESSAGE_BOX_TITLE = _("A game is in progress. Would you like to save it?")
# 16x16, 32x32, 48x48 gif images encoded in base64 # 16x16, 32x32, 48x48 gif images encoded in base64
ICON16 = """ ICON16 = """
@ -1451,7 +1462,8 @@ class App(Tk):
PhotoImage(name="icon16", data=ICON16), PhotoImage(name="icon16", data=ICON16),
PhotoImage(name="icon32", data=ICON32), PhotoImage(name="icon32", data=ICON32),
PhotoImage(name="icon48", data=ICON48), PhotoImage(name="icon48", data=ICON48),
) # Titlebar )
# Titlebar
try: # Windows taskbar icon try: # Windows taskbar icon
from ctypes import windll from ctypes import windll

BIN
locale/PySudoky.mo Normal file

Binary file not shown.

252
locale/PySudoky.pot Normal file
View File

@ -0,0 +1,252 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PySudoku V0.2\n"
"POT-Creation-Date: 2018-08-02 00:12+0200\n"
"PO-Revision-Date: 2018-08-02 00:01+0200\n"
"Last-Translator: \n"
"Language-Team: Adrien Malingrey adrien.malin@protonmail.com\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.1.1\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: PySudoku.py\n"
#: PySudoku.py:35
msgid "PySudoku"
msgstr ""
#: PySudoku.py:37
msgid "Grid"
msgstr ""
#: PySudoku.py:38
msgid "Generate..."
msgstr ""
#: PySudoku.py:39
msgid "Create"
msgstr ""
#: PySudoku.py:40
msgid "Edit"
msgstr ""
#: PySudoku.py:41
msgid "Validate"
msgstr ""
#: PySudoku.py:42
msgid "Solve"
msgstr ""
#: PySudoku.py:44
msgid "Game"
msgstr ""
#: PySudoku.py:45
msgid "Load..."
msgstr ""
#: PySudoku.py:46
msgid "Save..."
msgstr ""
#: PySudoku.py:47
msgid "Restart..."
msgstr ""
#: PySudoku.py:49
msgid "View"
msgstr ""
#: PySudoku.py:50
msgid "Theme"
msgstr ""
#: PySudoku.py:51
msgid "Show tips"
msgstr ""
#: PySudoku.py:52
msgid "Show conflicts"
msgstr ""
#: PySudoku.py:54
msgid "?"
msgstr ""
#: PySudoku.py:55
msgid "Wikipedia"
msgstr ""
#: PySudoku.py:56
msgid "About..."
msgstr ""
#: PySudoku.py:58
msgid "Grid generation"
msgstr ""
#: PySudoku.py:59
msgid "Generating a new grid..."
msgstr ""
#: PySudoku.py:60
msgid "Deleting clues..."
msgstr ""
#: PySudoku.py:61
msgid "Stop"
msgstr ""
#: PySudoku.py:63
msgid "Grid validation"
msgstr ""
#: PySudoku.py:64
msgid "Checking if grid has a solution..."
msgstr ""
#: PySudoku.py:66
msgid "Can't solve grid"
msgstr ""
#: PySudoku.py:68
msgid "Some boxes have no solution. Please correct it."
msgstr ""
#: PySudoku.py:71
msgid "Checking if grid has other solutions..."
msgstr ""
#: PySudoku.py:73
msgid "Incorrect grid"
msgstr ""
#: PySudoku.py:74
msgid "The grid has several solutions."
msgstr ""
#: PySudoku.py:76
msgid ""
"Some boxes from the same row, column or region have same digit. Please "
"correct them."
msgstr ""
#: PySudoku.py:80
msgid "Solving grid"
msgstr ""
#: PySudoku.py:81
msgid "Calculating sure digits..."
msgstr ""
#: PySudoku.py:82
msgid "Test: {} on {}"
msgstr ""
#: PySudoku.py:84
msgid "There are some error. Please correct them to solve the grid."
msgstr ""
#: PySudoku.py:87
msgid "Cancelled"
msgstr ""
#: PySudoku.py:89
msgid "Congratulations!"
msgstr ""
#: PySudoku.py:90
msgid "The grid is solved."
msgstr ""
#: PySudoku.py:92
msgid "Generate a new grid"
msgstr ""
#: PySudoku.py:93
msgid "Please enter minimum number of clues:"
msgstr ""
#: PySudoku.py:94
msgid "← harder"
msgstr ""
#: PySudoku.py:95
msgid "easier →"
msgstr ""
#: PySudoku.py:96
msgid "Cancel"
msgstr ""
#: PySudoku.py:97
msgid "OK"
msgstr ""
#: PySudoku.py:99
msgid "Cancelling..."
msgstr ""
#: PySudoku.py:100
msgid "Stopping..."
msgstr ""
#: PySudoku.py:102
msgid "Erase current game?"
msgstr ""
#: PySudoku.py:103
msgid "A game is in progress. Do you want to erase it?"
msgstr ""
#: PySudoku.py:105
msgid "Open game"
msgstr ""
#: PySudoku.py:106
msgid "PySudoku game"
msgstr ""
#: PySudoku.py:107
msgid "File error"
msgstr ""
#: PySudoku.py:108
msgid "The file {} can't be read."
msgstr ""
#: PySudoku.py:109
msgid "The file {} can't be found."
msgstr ""
#: PySudoku.py:111
msgid "Save game"
msgstr ""
#: PySudoku.py:113
msgid "https://en.wikipedia.org/wiki/Sudoku"
msgstr ""
#: PySudoku.py:115
msgid "About PySudoku"
msgstr ""
#: PySudoku.py:116
msgid ""
"Author: Adrien Malingrey\n"
"Licence: MIT"
msgstr ""
#: PySudoku.py:118
msgid "Save game?"
msgstr ""
#: PySudoku.py:119
msgid "A game is in progress. Would you like to save it?"
msgstr ""

Binary file not shown.

View File

@ -0,0 +1,262 @@
msgid ""
msgstr ""
"Project-Id-Version: PySudoku V0.2\n"
"POT-Creation-Date: 2018-08-02 00:12+0200\n"
"PO-Revision-Date: 2018-08-02 00:37+0200\n"
"Last-Translator: \n"
"Language-Team: Adrien Malingrey adrien.malin@protonmail.com\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.1.1\n"
"X-Poedit-Basepath: ../../..\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-SearchPath-0: PySudoku.py\n"
#: PySudoku.py:35
msgid "PySudoku"
msgstr ""
#: PySudoku.py:37
msgid "Grid"
msgstr "Grille"
#: PySudoku.py:38
msgid "Generate..."
msgstr "Générer..."
#: PySudoku.py:39
msgid "Create"
msgstr "Créer"
#: PySudoku.py:40
msgid "Edit"
msgstr "Éditer"
#: PySudoku.py:41
msgid "Validate"
msgstr "Valider"
#: PySudoku.py:42
msgid "Solve"
msgstr "Résoudre"
#: PySudoku.py:44
msgid "Game"
msgstr "Partie"
#: PySudoku.py:45
msgid "Load..."
msgstr "Charger..."
#: PySudoku.py:46
msgid "Save..."
msgstr "Sauvegarder..."
#: PySudoku.py:47
msgid "Restart..."
msgstr "Redémarrer..."
#: PySudoku.py:49
msgid "View"
msgstr "Affichage"
#: PySudoku.py:50
msgid "Theme"
msgstr "Thème"
#: PySudoku.py:51
msgid "Show tips"
msgstr "Afficher les info-bulles"
#: PySudoku.py:52
msgid "Show conflicts"
msgstr "Afficher les conflits"
#: PySudoku.py:54
msgid "?"
msgstr "?"
#: PySudoku.py:55
msgid "Wikipedia"
msgstr "Wikipédia"
#: PySudoku.py:56
msgid "About..."
msgstr "À propos..."
#: PySudoku.py:58
msgid "Grid generation"
msgstr "Génération d'une grille"
#: PySudoku.py:59
msgid "Generating a new grid..."
msgstr "Génération d'une nouvelle grille..."
#: PySudoku.py:60
msgid "Deleting clues..."
msgstr "Suppression d'indices..."
#: PySudoku.py:61
msgid "Stop"
msgstr "Arrêter"
#: PySudoku.py:63
msgid "Grid validation"
msgstr "Validation de la grille"
#: PySudoku.py:64
msgid "Checking if grid has a solution..."
msgstr "Vérification que la grille a une solution..."
#: PySudoku.py:66
msgid "Can't solve grid"
msgstr "Grille insoluble"
#: PySudoku.py:68
msgid "Some boxes have no solution. Please correct it."
msgstr ""
"La grille comporte des cases sans valeur possible. Corrigez-les pour pouvoir "
"valider la grille."
#: PySudoku.py:71
msgid "Checking if grid has other solutions..."
msgstr "Vérification qu'il n'y a pas d'autres solution..."
#: PySudoku.py:73
msgid "Incorrect grid"
msgstr "Grille incorrecte"
#: PySudoku.py:74
msgid "The grid has several solutions."
msgstr "La grille a plusieurs solutions possibles."
#: PySudoku.py:76
msgid ""
"Some boxes from the same row, column or region have same digit. Please "
"correct them."
msgstr ""
"La grille comporte des cases d'une même colonne, ligne ou région avec des "
"valeurs identiques. Veuillez les corriger."
#: PySudoku.py:80
msgid "Solving grid"
msgstr "Résolution de la grille"
#: PySudoku.py:81
msgid "Calculating sure digits..."
msgstr "Calcul des valeurs sûres..."
#: PySudoku.py:82
msgid "Test: {} on {}"
msgstr "Essai : {} en {}"
#: PySudoku.py:84
msgid "There are some error. Please correct them to solve the grid."
msgstr ""
"La grille comporte des erreurs. Corrigez-les pour pouvoir résoudre la grille."
#: PySudoku.py:87
msgid "Cancelled"
msgstr "Annulation"
#: PySudoku.py:89
msgid "Congratulations!"
msgstr "Bravo !"
#: PySudoku.py:90
msgid "The grid is solved."
msgstr "La grille est résolue."
#: PySudoku.py:92
msgid "Generate a new grid"
msgstr "Générer une nouvelle grille"
#: PySudoku.py:93
msgid "Please enter minimum number of clues:"
msgstr "Entrez le nombre minimum d'indices :"
#: PySudoku.py:94
msgid "← harder"
msgstr ""
"← plus\n"
"difficile"
#: PySudoku.py:95
msgid "easier →"
msgstr ""
"plus →\n"
"facile"
#: PySudoku.py:96
msgid "Cancel"
msgstr "Annuler"
#: PySudoku.py:97
msgid "OK"
msgstr "OK"
#: PySudoku.py:99
msgid "Cancelling..."
msgstr "Annulation..."
#: PySudoku.py:100
msgid "Stopping..."
msgstr "Arrêt..."
#: PySudoku.py:102
msgid "Erase current game?"
msgstr "Effacer la partie en cours ?"
#: PySudoku.py:103
msgid "A game is in progress. Do you want to erase it?"
msgstr "Une partie est en cours. Voulez-vous l'effacer ?"
#: PySudoku.py:105
msgid "Open game"
msgstr "Ouvrir une partie"
#: PySudoku.py:106
msgid "PySudoku game"
msgstr "Partie PySudoku"
#: PySudoku.py:107
msgid "File error"
msgstr "Erreur de fichier"
#: PySudoku.py:108
msgid "The file {} can't be read."
msgstr "Le fichier {} n'a pas pu être lu."
#: PySudoku.py:109
msgid "The file {} can't be found."
msgstr "Le fichier {} n'a pas été trouvé."
#: PySudoku.py:111
msgid "Save game"
msgstr "Enregistrer la partie"
#: PySudoku.py:113
msgid "https://en.wikipedia.org/wiki/Sudoku"
msgstr "https://fr.wikipedia.org/wiki/Sudoku"
#: PySudoku.py:115
msgid "About PySudoku"
msgstr "À propos de PySudoku"
#: PySudoku.py:116
msgid ""
"Author: Adrien Malingrey\n"
"Licence: MIT"
msgstr ""
"Auteur : Adrien Malingrey\n"
"Licence : MIT"
#: PySudoku.py:118
msgid "Save game?"
msgstr "Enregistrer la partie ?"
#: PySudoku.py:119
msgid "A game is in progress. Would you like to save it?"
msgstr "Une partie est en cours. Voulez-vous l'enregistrer ?"