Commit 1df50a44 authored by Michal Čihař's avatar Michal Čihař

Factor out language direction settings

parent c1dcd6b2
...@@ -198,10 +198,8 @@ class LanguageManager(models.Manager): ...@@ -198,10 +198,8 @@ class LanguageManager(models.Manager):
lang.nplurals = 2 lang.nplurals = 2
lang.pluralequation = 'n != 1' lang.pluralequation = 'n != 1'
if code in data.RTL_LANGS: # Set language direction
lang.direction = 'rtl' lang.set_direction()
else:
lang.direction = 'ltr'
# Get plural type # Get plural type
lang.plural_tupe = get_plural_type( lang.plural_tupe = get_plural_type(
...@@ -426,3 +424,12 @@ class Language(models.Model): ...@@ -426,3 +424,12 @@ class Language(models.Model):
self.name = 'Norwegian Bokmål' self.name = 'Norwegian Bokmål'
elif self.code == 'pa': elif self.code == 'pa':
self.name = 'Punjabi' self.name = 'Punjabi'
def set_direction(self):
'''
Sets default direction for language.
'''
if self.code in data.RTL_LANGS:
self.direction = 'rtl'
else:
self.direction = 'ltr'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment