mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Internationalize more functions in src/utils/str.py
This commit is contained in:
parent
5339516257
commit
ec6a267c09
21
src/i18n.py
21
src/i18n.py
@ -195,6 +195,27 @@ class PluginInternationalization:
|
|||||||
else:
|
else:
|
||||||
return (current_pluralize, current_depluralize)
|
return (current_pluralize, current_depluralize)
|
||||||
|
|
||||||
|
def getOrdinal(self, current_ordinal):
|
||||||
|
# This should be used only by src/utils/str.py
|
||||||
|
try:
|
||||||
|
execfile(self._getL10nCode())
|
||||||
|
except IOError:
|
||||||
|
pass # Handled by the else v-
|
||||||
|
if locals().has_key('ordinal'):
|
||||||
|
return ordinal
|
||||||
|
else:
|
||||||
|
return current_ordinal
|
||||||
|
|
||||||
|
def getBeAndHave(self, current_be, current_have):
|
||||||
|
# This should be used only by src/utils/str.py
|
||||||
|
try:
|
||||||
|
execfile(self._getL10nCode())
|
||||||
|
except IOError:
|
||||||
|
pass # Handled by the else v-
|
||||||
|
if locals().has_key('be') and locals().has_key('have'):
|
||||||
|
return (be, have)
|
||||||
|
else:
|
||||||
|
return (current_be, current_have)
|
||||||
|
|
||||||
def internationalizeDocstring(obj):
|
def internationalizeDocstring(obj):
|
||||||
# FIXME: check if the plugin has an _ object
|
# FIXME: check if the plugin has an _ object
|
||||||
|
@ -350,6 +350,8 @@ def ordinal(i):
|
|||||||
ord = 'rd'
|
ord = 'rd'
|
||||||
return '%s%s' % (i, ord)
|
return '%s%s' % (i, ord)
|
||||||
|
|
||||||
|
ordinal = _.getOrdinal(ordinal)
|
||||||
|
|
||||||
def be(i):
|
def be(i):
|
||||||
"""Returns the form of the verb 'to be' based on the number i."""
|
"""Returns the form of the verb 'to be' based on the number i."""
|
||||||
if i == 1:
|
if i == 1:
|
||||||
@ -364,6 +366,8 @@ def has(i):
|
|||||||
else:
|
else:
|
||||||
return 'have'
|
return 'have'
|
||||||
|
|
||||||
|
be, have = _.getVerbs(be, have)
|
||||||
|
|
||||||
def toBool(s):
|
def toBool(s):
|
||||||
s = s.strip().lower()
|
s = s.strip().lower()
|
||||||
if s in ('true', 'on', 'enable', 'enabled', '1'):
|
if s in ('true', 'on', 'enable', 'enabled', '1'):
|
||||||
|
Loading…
Reference in New Issue
Block a user