forked from openlp/openlp
fix warning in reges
bzr-revno: 2832
This commit is contained in:
commit
2f465a9dd9
@ -271,9 +271,10 @@ class LanguageManager(object):
|
||||
language = Settings().value('core/language')
|
||||
language = str(language)
|
||||
log.info("Language file: '{language}' Loaded from conf file".format(language=language))
|
||||
if re.match(r'[[].*[]]', language):
|
||||
m = re.match(r'\[(.*)\]', language)
|
||||
if m:
|
||||
LanguageManager.auto_language = True
|
||||
language = re.sub(r'[\[\]]', '', language)
|
||||
language = m.group(1)
|
||||
return language
|
||||
|
||||
@staticmethod
|
||||
|
@ -27,7 +27,8 @@ from unittest.mock import MagicMock, patch
|
||||
|
||||
from openlp.core.common import is_macosx
|
||||
from openlp.core.common.i18n import LANGUAGES, Language, UiStrings, get_language, get_locale_key, get_natural_key, \
|
||||
translate
|
||||
translate, LanguageManager
|
||||
from openlp.core.common.settings import Settings
|
||||
|
||||
|
||||
def test_languages_type():
|
||||
@ -158,6 +159,14 @@ def test_check_same_instance():
|
||||
assert first_instance is second_instance, 'Two UiStrings objects should be the same instance'
|
||||
|
||||
|
||||
def test_get_language_from_settings():
|
||||
assert LanguageManager.get_language() == 'en'
|
||||
|
||||
def test_get_language_from_settings_returns_unchanged_if_unknown_format():
|
||||
Settings().setValue('core/language', '(foobar)')
|
||||
assert LanguageManager.get_language() == '(foobar)'
|
||||
|
||||
|
||||
def test_translate():
|
||||
"""
|
||||
Test the translate() function
|
||||
|
Loading…
Reference in New Issue
Block a user