Prepare strings for lang system

This commit is contained in:
Matyáš Caras 2022-02-27 12:02:46 +01:00
parent 6327aed543
commit ef7b949895
4 changed files with 44 additions and 7 deletions

View file

@ -61,7 +61,7 @@ class Game: # the game class keeps information about the loaded game
exit()
def settings_menu(self): # displays the settings menu
print("Settings")
print("Options")
print("")
print("1 - Language")
print("0 - Back")
@ -85,6 +85,7 @@ class Game: # the game class keeps information about the loaded game
self.main_menu()
def make_selection(self, length=0) -> int: # this method makes sure a valid selection is made and returns the selection as a number
# TODO: replace with selection by keyboard(?)
l = length # sets the length
if(l == 0): # if no length was set, we get it from nodes
l = len(self.nodes[self.current]["actions"])-1

View file

@ -1 +1,19 @@
TODO: "todo"
yaml_unspecified: 'Musíte specifikovat YAML soubor'
game_by: 'Vytvořil $author'
start: 'Start'
options: 'Nastavení'
quit: 'Vypnout'
quitting: 'Vypínám'
continue: 'Pokračovat'
new_game: 'Nová hra'
lang: 'Jazyk'
back: 'Zpět'
lang_en: 'Angličtina'
lang_cz: 'Čeština'
selection: 'Vyberte zadáním čísla:'
not_number: 'Nezadali jste číslo'
invalid: 'Neplatný výběr'
error_loading: 'Při načítání YAML souboru nastala chyba:'

View file

@ -1 +1,19 @@
TODO: "todo"
yaml_unspecified: 'You need to specify a path to a YAML file'
game_by: 'A game by $author'
start: 'Start'
options: 'Options'
quit: 'Quit'
quitting: 'Quitting'
continue: 'Continue'
new_game: 'New game'
lang: 'Language'
back: 'Back'
lang_en: 'English'
lang_cz: 'Czech'
selection: 'Make a selection (number):'
not_number: 'Not a number selection'
invalid: 'Invalid selection'
error_loading: 'An exception has occured while loading the game from the YAML file:'

View file

@ -3,10 +3,10 @@ import yaml
class SaveManager: # manages save and configuration files
def __init__(self):
self.id = ""
self.currentPrompt = ""
self.lang = ""
self.inventory = []
self.id = "" # game ID
self.currentPrompt = "" # Current prompt
self.lang = "" # Selected language
self.inventory = [] # Items in inventory
def load(self):
if(path.exists(f"./saves/{self.id}.yml")):