forked from openlp/openlp
Fixed exception thrown on unchecking 'Auto detect' in languages menu
Fixed saving of language setting Added pinging of review page in translation_util.py bzr-revno: 1056
This commit is contained in:
commit
70f8795d61
@ -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'))
|
||||
|
@ -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:
|
||||
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,7 +131,9 @@ 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]
|
||||
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
|
||||
|
||||
|
0
openlp/plugins/songs/lib/test/test3.opensong
Executable file → Normal file
0
openlp/plugins/songs/lib/test/test3.opensong
Executable file → Normal file
@ -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=
|
||||
|
@ -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():
|
||||
|
Loading…
Reference in New Issue
Block a user