mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Merge branch 'i18n' into l10n-fr
This commit is contained in:
commit
6484df8d46
22
src/i18n.py
22
src/i18n.py
@ -184,17 +184,29 @@ class PluginInternationalization:
|
|||||||
def _getL10nCode(self):
|
def _getL10nCode(self):
|
||||||
return getLocalePath('supybot', self.currentLocaleName, 'py')
|
return getLocalePath('supybot', self.currentLocaleName, 'py')
|
||||||
|
|
||||||
def getPluralizers(self, current_pluralize, current_depluralize):
|
def getPluralizers(self, pluralize, depluralize):
|
||||||
# This should be used only by src/utils/str.py
|
# This should be used only by src/utils/str.py
|
||||||
try:
|
try:
|
||||||
execfile(self._getL10nCode())
|
execfile(self._getL10nCode())
|
||||||
except IOError:
|
except IOError:
|
||||||
pass # Handled by the else v-
|
pass
|
||||||
if locals().has_key('pluralize') and locals().has_key('depluralize'):
|
|
||||||
return (pluralize, depluralize)
|
return (pluralize, depluralize)
|
||||||
else:
|
|
||||||
return (current_pluralize, current_depluralize)
|
|
||||||
|
|
||||||
|
def getOrdinal(self, ordinal):
|
||||||
|
# This should be used only by src/utils/str.py
|
||||||
|
try:
|
||||||
|
execfile(self._getL10nCode())
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
return ordinal
|
||||||
|
|
||||||
|
def getBeAndHave(self, be, have):
|
||||||
|
# This should be used only by src/utils/str.py
|
||||||
|
try:
|
||||||
|
execfile(self._getL10nCode())
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
return (be, 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