openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #03771
[Merge] lp:~crichter/openlp/bugfixing into lp:openlp
rimach has proposed merging lp:~crichter/openlp/bugfixing into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
fix click/unclick 'Auto detect', fix saving of language setting
add pinging of review page in translation_util.py
--
https://code.launchpad.net/~crichter/openlp/bugfixing/+merge/36356
Your team OpenLP Core is requested to review the proposed merge of lp:~crichter/openlp/bugfixing into lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2010-09-18 18:15:54 +0000
+++ openlp/core/ui/mainwindow.py 2010-09-22 18:14:43 +0000
@@ -343,7 +343,7 @@
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'))
=== modified file 'openlp/core/utils/languagemanager.py'
--- openlp/core/utils/languagemanager.py 2010-09-21 19:53:46 +0000
+++ openlp/core/utils/languagemanager.py 2010-09-22 18:14:43 +0000
@@ -82,7 +82,8 @@
"""
translator = QtCore.QTranslator()
translator.load(qm_file)
- return translator.translate('OpenLP.MainWindow', 'English')
+ return translator.translate('OpenLP.MainWindow', 'English',
+ 'Please add here the name of your Language')
@staticmethod
def get_language():
@@ -107,15 +108,13 @@
``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 @@
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():
=== modified file 'openlp/plugins/songs/lib/test/test3.opensong' (properties changed: +x to -x)
=== modified file 'resources/openlp.desktop'
--- resources/openlp.desktop 2010-09-16 21:04:02 +0000
+++ resources/openlp.desktop 2010-09-22 18:14:43 +0000
@@ -1,11 +1,21 @@
-#!/usr/bin/env xdg-open
[Desktop Entry]
+Categories=AudioVideo;
+Comment[de]=
+Comment=
Encoding=UTF-8
-Name=OpenLP
+Exec=openlp
+GenericName[de]=Church lyrics projection
GenericName=Church lyrics projection
-Exec=openlp
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=
=== modified file 'scripts/translation_utils.py'
--- scripts/translation_utils.py 2010-09-22 05:41:22 +0000
+++ scripts/translation_utils.py 2010-09-22 18:14:43 +0000
@@ -157,6 +157,21 @@
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 @@
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():
Follow ups