add internationalization for objects.objects.py

This commit is contained in:
JohniFi 2025-03-28 11:18:41 +01:00
parent 5b2963fc46
commit f49f80a8f3

View file

@ -1382,13 +1382,14 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase):
if obj.has_account: if obj.has_account:
if home: if home:
string = "Your current location has ceased to exist," string = _(
string += " moving you to (#{dbid})." "Your current location has ceased to exist,"
obj.msg(_(string).format(dbid=home.dbid)) " moving you to (#{dbid})."
)
obj.msg(string.format(dbid=home.dbid))
else: else:
# Famous last words: The account should never see this. # Famous last words: The account should never see this.
string = "This place should not exist ... contact an admin." obj.msg(_("This place should not exist ... contact an admin."))
obj.msg(_(string))
obj.move_to(home, move_type="teleport") obj.move_to(home, move_type="teleport")
@classmethod @classmethod
@ -2141,7 +2142,7 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase):
puppeting this Object. puppeting this Object.
""" """
self.msg(f"You become |w{self.key}|n.") self.msg(_("You become |w{key}|n.").format(key=self.key))
self.account.db._last_puppet = self self.account.db._last_puppet = self
def at_pre_unpuppet(self, **kwargs): def at_pre_unpuppet(self, **kwargs):
@ -2798,7 +2799,7 @@ class DefaultObject(ObjectDB, metaclass=TypeclassBase):
# TODO: This if-statment will be removed in Evennia 1.0 # TODO: This if-statment will be removed in Evennia 1.0
return True return True
if not self.access(dropper, "drop", default=False): if not self.access(dropper, "drop", default=False):
dropper.msg(f"You cannot drop {self.get_display_name(dropper)}") dropper.msg(_("You cannot drop {obj}").format(obj=self.get_display_name(dropper)))
return False return False
return True return True