diff options
author | Michael Birtwell <michael.birtwell@starleaf.com> | 2015-09-30 18:57:30 +0100 |
---|---|---|
committer | Michael Birtwell <michael.birtwell@gmail.com> | 2015-10-31 14:27:00 +0000 |
commit | b3f3430d2e77871fdca0b119adf0b22b9140ffa2 (patch) | |
tree | 36457f9a395b9927d9c54b5fe31e70a4069cf7d8 /babel/core.py | |
parent | 5116c167241d7e01870f17adf8de0a1c86744ea4 (diff) | |
download | babel-b3f3430d2e77871fdca0b119adf0b22b9140ffa2.tar.gz |
Add an ordinal_form property to Locale
Diffstat (limited to 'babel/core.py')
-rw-r--r-- | babel/core.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/babel/core.py b/babel/core.py index 7d24257..0b314cd 100644 --- a/babel/core.py +++ b/babel/core.py @@ -756,6 +756,23 @@ class Locale(object): """ return self._data['list_patterns'] + @property + def ordinal_form(self): + """Plural rules for the locale. + + >>> Locale('en').ordinal_form(1) + 'one' + >>> Locale('en').ordinal_form(2) + 'two' + >>> Locale('en').ordinal_form(3) + 'few' + >>> Locale('fr').ordinal_form(2) + 'other' + >>> Locale('ru').ordinal_form(100) + 'other' + """ + return self._data.get('ordinal_form', _default_plural_rule) + def default_locale(category=None, aliases=LOCALE_ALIASES): """Returns the system default locale for a given category, based on |