Translate strings

This commit is contained in:
Yohann D'ANELLO
2020-11-27 20:42:19 +01:00
parent e3be4b4f3f
commit 2498fd2a61
8 changed files with 163 additions and 29 deletions

View File

@ -1,5 +1,6 @@
# Copyright (C) 2020 by ÿnérant, eichhornchen, nicomarg, charlse
# SPDX-License-Identifier: GPL-3.0-or-later
from json import JSONDecodeError
from random import randint
from typing import Any, Optional
@ -13,6 +14,7 @@ from .interfaces import Map, Logs
from .resources import ResourceManager
from .settings import Settings
from . import menus
from .translations import gettext as _
from typing import Callable
@ -142,16 +144,16 @@ class Game:
try:
self.map.load_state(d)
except KeyError:
self.message = "Some keys are missing in your save file.\n" \
"Your save seems to be corrupt. It got deleted."
self.message = _("Some keys are missing in your save file.\n"
"Your save seems to be corrupt. It got deleted.")
os.unlink(ResourceManager.get_config_path("save.json"))
self.display_actions(DisplayActions.UPDATE)
return
players = self.map.find_entities(Player)
if not players:
self.message = "No player was found on this map!\n" \
"Maybe you died?"
self.message = _("No player was found on this map!\n"
"Maybe you died?")
self.player.health = 0
self.display_actions(DisplayActions.UPDATE)
return
@ -170,8 +172,9 @@ class Game:
state = json.loads(f.read())
self.load_state(state)
except JSONDecodeError:
self.message = "The JSON file is not correct.\n" \
"Your save seems corrupted. It got deleted."
self.message = _("The JSON file is not correct.\n"
"Your save seems corrupted."
"It got deleted.")
os.unlink(file_path)
self.display_actions(DisplayActions.UPDATE)