Commit 4a139f6c authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents 943bad2f 1df50a44
...@@ -173,22 +173,9 @@ class LanguageManager(models.Manager): ...@@ -173,22 +173,9 @@ class LanguageManager(models.Manager):
if not update and not created: if not update and not created:
continue continue
# Fixups (mostly shortening) of langauge names # Set language name
if code == 'ia':
lang.name = 'Interlingua'
elif code == 'el':
lang.name = 'Greek'
elif code == 'st':
lang.name = 'Sotho'
elif code == 'oc':
lang.name = 'Occitan'
elif code == 'nb':
lang.name = 'Norwegian Bokmål'
elif code == 'pa':
lang.name = 'Punjabi'
else:
# Standard ttkit language name
lang.name = props[0].split(';')[0] lang.name = props[0].split(';')[0]
lang.fixup_name()
# Read values # Read values
lang.nplurals = props[1] lang.nplurals = props[1]
...@@ -211,10 +198,8 @@ class LanguageManager(models.Manager): ...@@ -211,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(
...@@ -416,4 +401,35 @@ class Language(models.Model): ...@@ -416,4 +401,35 @@ class Language(models.Model):
return round(translated * 100.0 / total, 1) return round(translated * 100.0 / total, 1)
def get_html(self): def get_html(self):
'''
Returns html attributes for markup in this language, includes
language and direction.
'''
return 'lang="%s" dir="%s"' % (self.code, self.direction) return 'lang="%s" dir="%s"' % (self.code, self.direction)
def fixup_name(self):
'''
Fixes name, in most cases when wrong one is provided by ttkit.
'''
# Fixups (mostly shortening) of langauge names
if self.code == 'ia':
self.name = 'Interlingua'
elif self.code == 'el':
self.name = 'Greek'
elif self.code == 'st':
self.name = 'Sotho'
elif self.code == 'oc':
self.name = 'Occitan'
elif self.code == 'nb':
self.name = 'Norwegian Bokmål'
elif self.code == 'pa':
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'
...@@ -31,6 +31,9 @@ import weblate ...@@ -31,6 +31,9 @@ import weblate
import os import os
# List of default domain names on which warn user
DEFAULT_DOMAINS = ('example.net', 'example.com')
@staff_member_required @staff_member_required
def report(request): def report(request):
...@@ -57,7 +60,7 @@ def performance(request): ...@@ -57,7 +60,7 @@ def performance(request):
# Check for domain configuration # Check for domain configuration
checks.append(( checks.append((
_('Site domain'), _('Site domain'),
Site.objects.get_current().domain not in ('example.net', 'example.com'), Site.objects.get_current().domain not in DEFAULT_DOMAINS,
'production-site', 'production-site',
)) ))
# Check database being used # Check database being used
......
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