diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 0d158d042..10f1ee92e 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -343,7 +343,7 @@ class Ui_MainWindow(object): Set up the translation system """ MainWindow.mainTitle = translate('OpenLP.MainWindow', 'OpenLP 2.0') - MainWindow.language = translate('OpenLP.MainWindow', 'English') +# MainWindow.language = translate('OpenLP.MainWindow', 'English') MainWindow.setWindowTitle(MainWindow.mainTitle) self.FileMenu.setTitle(translate('OpenLP.MainWindow', '&File')) self.FileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import')) diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index f118c64b0..000328d50 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -82,7 +82,8 @@ class LanguageManager(object): """ translator = QtCore.QTranslator() translator.load(qm_file) - return translator.translate('OpenLP.MainWindow', 'English') + return translator.translate('OpenLP.MainWindow', 'English', + 'Please add the name of your language here') @staticmethod def get_language(): @@ -107,15 +108,13 @@ class LanguageManager(object): ``action`` The language menu option """ - if action is None: - action_name = u'en' - else: + language = u'en' + if action: action_name = u'%s' % action.objectName() - qm_list = LanguageManager.get_qm_list() - if LanguageManager.auto_language: - language = u'[%s]' % qm_list[action_name] - else: + qm_list = LanguageManager.get_qm_list() language = u'%s' % qm_list[action_name] + if LanguageManager.auto_language: + language = u'[%s]' % language QtCore.QSettings().setValue( u'general/language', QtCore.QVariant(language)) log.info(u'Language file: \'%s\' written to conf file' % language) @@ -132,9 +131,11 @@ class LanguageManager(object): LanguageManager.__qm_list__ = {} qm_files = LanguageManager.find_qm_files() for counter, qmf in enumerate(qm_files): - name = unicode(qmf).split(u'.')[0] - LanguageManager.__qm_list__[u'%#2i %s' % (counter + 1, - LanguageManager.language_name(qmf))] = name + reg_ex = QtCore.QRegExp("^.*i18n/(.*).qm") + if reg_ex.exactMatch(qmf): + name = u'%s' % reg_ex.cap(1) + LanguageManager.__qm_list__[u'%#2i %s' % (counter + 1, + LanguageManager.language_name(qmf))] = name @staticmethod def get_qm_list(): diff --git a/openlp/plugins/songs/lib/test/test3.opensong b/openlp/plugins/songs/lib/test/test3.opensong old mode 100755 new mode 100644 diff --git a/resources/openlp.desktop b/resources/openlp.desktop index d84f69297..684119773 100755 --- a/resources/openlp.desktop +++ b/resources/openlp.desktop @@ -1,11 +1,21 @@ -#!/usr/bin/env xdg-open [Desktop Entry] +Categories=AudioVideo; +Comment[de]= +Comment= Encoding=UTF-8 -Name=OpenLP -GenericName=Church lyrics projection Exec=openlp +GenericName[de]=Church lyrics projection +GenericName=Church lyrics projection Icon=openlp +MimeType= +Name[de]=OpenLP +Name=OpenLP +Path= StartupNotify=true Terminal=false +TerminalOptions= Type=Application -Categories=AudioVideo; +X-DBUS-ServiceName= +X-DBUS-StartupType= +X-KDE-SubstituteUID=false +X-KDE-Username= diff --git a/scripts/translation_utils.py b/scripts/translation_utils.py index 4704c4dc5..424e977bd 100755 --- a/scripts/translation_utils.py +++ b/scripts/translation_utils.py @@ -157,6 +157,21 @@ def run(command): print_verbose(u'Output:\n%s' % process.readAllStandardOutput()) print u' Done.' +def update_export_at_pootle(source_filename): + """ + This is needed because of database and exported *.ts file can be out of sync + + ``source_filename`` + The file to sync. + + """ + language = source_filename[:-3] + REVIEW_URL = u'http://pootle.projecthq.biz/%s/openlp/review.html' % language + print_verbose(u'Accessing: %s' % (REVIEW_URL)) + page = urllib.urlopen(REVIEW_URL) + page.close() + + def download_file(source_filename, dest_filename): """ Download a file and save it to disk. @@ -183,11 +198,13 @@ def download_translations(): page = urllib.urlopen(SERVER_URL) soup = BeautifulSoup(page) languages = soup.findAll(text=re.compile(r'.*\.ts')) - for language in languages: + for language_file in languages: + update_export_at_pootle(language_file) + for language_file in languages: filename = os.path.join(os.path.abspath(u'..'), u'resources', u'i18n', - language) + language_file) print_verbose(u'Get Translation File: %s' % filename) - download_file(language, filename) + download_file(language_file, filename) print u' Done.' def prepare_project():