Translate strings
This commit is contained in:
@ -6,7 +6,8 @@ from math import sqrt
|
||||
from random import choice, randint
|
||||
from typing import List, Optional
|
||||
|
||||
from squirrelbattle.display.texturepack import TexturePack
|
||||
from .display.texturepack import TexturePack
|
||||
from .translations import gettext as _
|
||||
|
||||
|
||||
class Logs:
|
||||
@ -390,7 +391,8 @@ class FightingEntity(Entity):
|
||||
"""
|
||||
Deals damage to the opponent, based on the stats
|
||||
"""
|
||||
return f"{self.name} hits {opponent.name}. "\
|
||||
return _("{name} hits {opponent}.")\
|
||||
.format(name=str(self), opponent=str(opponent)) + " "\
|
||||
+ opponent.take_damage(self, self.strength)
|
||||
|
||||
def take_damage(self, attacker: "Entity", amount: int) -> str:
|
||||
@ -400,8 +402,10 @@ class FightingEntity(Entity):
|
||||
self.health -= amount
|
||||
if self.health <= 0:
|
||||
self.die()
|
||||
return f"{self.name} takes {amount} damage."\
|
||||
+ (f" {self.name} dies." if self.health <= 0 else "")
|
||||
return _("{name} takes {amount} damage.")\
|
||||
.format(name=str(self), amount=str(amount)) \
|
||||
+ (" " + "{name} dies.".format(name=str(self))
|
||||
if self.health <= 0 else "")
|
||||
|
||||
def die(self) -> None:
|
||||
"""
|
||||
|
Reference in New Issue
Block a user