mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Fix case of i18n.InternationalizedString.
This commit is contained in:
parent
f3e292d518
commit
9b365d1ed8
10
src/i18n.py
10
src/i18n.py
@ -250,7 +250,7 @@ class _PluginInternationalization:
|
|||||||
"""Main function.
|
"""Main function.
|
||||||
|
|
||||||
This is the function which is called when a plugin runs _()"""
|
This is the function which is called when a plugin runs _()"""
|
||||||
if untranslated.__class__ == internationalizedString:
|
if untranslated.__class__ is InternationalizedString:
|
||||||
return untranslated._original
|
return untranslated._original
|
||||||
escapedUntranslated = self._unescape(untranslated, True)
|
escapedUntranslated = self._unescape(untranslated, True)
|
||||||
untranslated = self._unescape(untranslated, False)
|
untranslated = self._unescape(untranslated, False)
|
||||||
@ -265,7 +265,7 @@ class _PluginInternationalization:
|
|||||||
"""Translate the string.
|
"""Translate the string.
|
||||||
|
|
||||||
C the string internationalizer if any; else, use the local database"""
|
C the string internationalizer if any; else, use the local database"""
|
||||||
if string.__class__ == internationalizedString:
|
if string.__class__ == InternationalizedString:
|
||||||
return string._internationalizer(string.untranslated)
|
return string._internationalizer(string.untranslated)
|
||||||
else:
|
else:
|
||||||
return self.translations[string]
|
return self.translations[string]
|
||||||
@ -273,10 +273,10 @@ class _PluginInternationalization:
|
|||||||
def _addTracker(self, string, untranslated):
|
def _addTracker(self, string, untranslated):
|
||||||
"""Add a kind of 'tracker' on the string, in order to keep the
|
"""Add a kind of 'tracker' on the string, in order to keep the
|
||||||
untranslated string (used when changing the locale)"""
|
untranslated string (used when changing the locale)"""
|
||||||
if string.__class__ == internationalizedString:
|
if string.__class__ == InternationalizedString:
|
||||||
return string
|
return string
|
||||||
else:
|
else:
|
||||||
string = internationalizedString(string)
|
string = InternationalizedString(string)
|
||||||
string._original = untranslated
|
string._original = untranslated
|
||||||
string._internationalizer = self
|
string._internationalizer = self
|
||||||
return string
|
return string
|
||||||
@ -350,7 +350,7 @@ class internationalizedFunction:
|
|||||||
def __call__(self, *args, **kwargs):
|
def __call__(self, *args, **kwargs):
|
||||||
return self._origin(*args, **kwargs)
|
return self._origin(*args, **kwargs)
|
||||||
|
|
||||||
class internationalizedString(str):
|
class InternationalizedString(str):
|
||||||
"""Simple subclass to str, that allow to add attributes. Also used to
|
"""Simple subclass to str, that allow to add attributes. Also used to
|
||||||
know if a string is already localized"""
|
know if a string is already localized"""
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user