From bc8d615689571bc68f28237cb2c736579a9ebac1 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sat, 24 Oct 2009 09:14:11 +0200 Subject: [PATCH] Translation done! --- i18n/openlp_en.ts | 1024 +++++++++++++++++++++++++++++++++++--- openlp-1to2-converter.py | 22 + openlp-get-strings.py | 98 ++++ 3 files changed, 1080 insertions(+), 64 deletions(-) create mode 100644 openlp-get-strings.py diff --git a/i18n/openlp_en.ts b/i18n/openlp_en.ts index 3d66550cb..d92273c1d 100644 --- a/i18n/openlp_en.ts +++ b/i18n/openlp_en.ts @@ -1,95 +1,991 @@ - - - AmendThemeForm + + + + BibleMediaItem - - Open file - + + Quick + - - - AuditDeleteDialog + + + AlertsTab - - Audit Delete - - - - - AuditDetailDialog - - - Audit Detail Extraction - + + Alerts + - - Report Location - + + Font + + + + Ui_OpenLPExportDialog - - Report Type - + + Author + + + + Ui_AmendThemeDialog - - Summary - + + Vertical + + + + AlertForm - - Detailed - + + Display + + + + SplashScreen - - Select Date Range - + + Starting + + + + MediaManagerItem - - dd/MM/yyyy - + + New + + + + EditCustomForm - - to - + + Error + + + + Ui_AmendThemeDialog - - Select Time Periods - + + Center + + + + TestMediaManager: - - First Service - + + Item2 + + + + AboutForm - - hh:mm AP - + + License + + + + TestMediaManager: - - Second Service - + + Item1 + - - - Third Service - - - - + + Ui_MainWindow - - Default Theme: - + + English + - + + + Ui_AmendThemeDialog + + + pt + + + + + Ui_OpenSongImportDialog + + + Close + + + + + Ui_AmendThemeDialog + + + Middle + + + + + Opaque + + + + + Ui_customEditDialog + + + Clear + + + + + Save + + + + + BibleImportForm + + + Information + + + + + Ui_OpenSongExportDialog + + + Lyrics + + + + + Ui_customEditDialog + + + Delete + + + + + Ui_OpenLPImportDialog + + + Close + + + + + ImageTab + + + sec + + + + + Ui_OpenSongExportDialog + + + Close + + + + + BibleMediaItem + + + Clear + + + + + Ui_OpenSongExportDialog + + + Author + + + + + Ui_PluginViewDialog + + + Inactive + + + + + Ui_OpenLPImportDialog + + + Import + + + + + Ui_MainWindow + + + F9 + + + + + F8 + + + + + Ui_SongMaintenanceDialog + + + Topics + + + + + Ui_AmendThemeDialog + + + Left + + + + + SongMaintenanceForm + + + Error + + + + + Ui_AmendThemeDialog + + + Top + + + + + Ui_MainWindow + + + F7 + + + + + Ui_AmendThemeDialog + + + Alignment + + + + + MediaManagerItem + + + Add + + + + + BibleMediaItem + + + Search + + + + + Ui_SongMaintenanceDialog + + + Edit + + + + + Ui_EditSongDialog + + + Theme + + + + + SongsPlugin + + + OpenSong + + + + + MediaManagerItem + + + Edit + + + + + Load + + + + + Ui_AmendThemeDialog + + + Bottom + + + + + Ui_BibleImportDialog + + + NIV + + + + + Ui_AmendThemeDialog + + + Image + + + + + GeneralTab + + + Screen + + + + + ThemeManager + + + Error + + + + + Ui_AmendThemeDialog + + + Normal + + + + + AlertsTab + + + s + + + + + Ui_OpenLPExportDialog + + + Close + + + + + Ui_OpenLPImportDialog + + + Author + + + + + BiblesTab + + + Bibles + + + + + Ui_AuditDetailDialog + + + Summary + + + + + Ui_BibleImportDialog + + + Import + + + + + SongBookForm + + + Error + + + + + Ui_OpenLPImportDialog + + + Title + + + + + Ui_PluginViewDialog + + + TextLabel + + + + + AboutForm + + + Contribute + + + + + GeneralTab + + + Monitors + + + + + Ui_AmendThemeDialog + + + Bold + + + + + TopicsForm + + + Error + + + + + SlideController + + + Preview + + + + + Ui_OpenLPExportDialog + + + Export + + + + + BibleMediaItem + + + Keep + + + + + Ui_AmendThemeDialog + + + Right + + + + + Ui_EditSongDialog + + + Comments + + + + + AboutForm + + + Credits + + + + + AlertForm + + + Cancel + + + + + AuthorsForm + + + Error + + + + + Ui_OpenSongExportDialog + + + Export + + + + + MediaManagerItem + + + Preview + + + + + Ui_SettingsDialog + + + Settings + + + + + BibleMediaItem + + + Information + + + + + Ui_OpenLPExportDialog + + + Lyrics + + + + + ImageTab + + + Images + + + + + Ui_AmendThemeDialog + + + Horizontal + + + + + Circular + + + + + Ui_EditSongDialog + + + Topic + + + + + BibleMediaItem + + + Advanced + + + + + MediaTab + + + Media + + + + + AboutForm + + + Close + + + + + Ui_EditSongDialog + + + Edit + + + + + Ui_OpenLPImportDialog + + + Lyrics + + + + + Ui_AmendThemeDialog + + + px + + + + + Ui_EditSongDialog + + + Delete + + + + + Ui_OpenSongExportDialog + + + Title + + + + + ThemesTab + + + Themes + + + + + Ui_EditSongDialog + + + Authors + + + + + Ui_BibleImportDialog + + + KJV + + + + + Ui_SongMaintenanceDialog + + + Authors + + + + + Ui_AuditDetailDialog + + + Detailed + + + + + Ui_SongMaintenanceDialog + + + Delete + + + + + SlideController + + + s + + + + + SongMediaItem + + + Titles + + + + + Clear + + + + + Ui_BibleImportDialog + + + Crosswalk + + + + + Ui_customEditDialog + + + Edit + + + + + PresentationTab + + + available + + + + + ThemeManager + + + default + + + + + EditSongForm + + + Error + + + + + Ui_SongMaintenanceDialog + + + Add + + + + + Ui_BibleImportDialog + + + Cancel + + + + + Ui_OpenLPExportDialog + + + Title + + + + + GeneralTab + + + General + + + + + primary + + + + + Ui_AmendThemeDialog + + + Preview + + + + + SlideController + + + Live + + + + + AlertsTab + + + Preview + + + + + BiblesTab + + + continuous + + + + + Ui_AmendThemeDialog + + + Transparent + + + + + SongMediaItem + + + Search + + + + + Ui_OpenSongImportDialog + + + Import + + + + + Ui_AmendThemeDialog + + + Background + + + + + Ui_EditSongDialog + + + Add + + + + + SongMediaItem + + + Lyrics + + + + + MediaManagerItem + + + Delete + + + + + Ui_MainWindow + + + F11 + + + + + F10 + + + + + Ui_AuditDetailDialog + + + to + + + + + Ui_MainWindow + + + F12 + + + + + SongMediaItem + + + Authors + + + + + Ui_PluginViewDialog + + + Active + + + + + Ui_AmendThemeDialog + + + Italics + + + + + Gradient + + + + diff --git a/openlp-1to2-converter.py b/openlp-1to2-converter.py index dd1d601dd..bccb44d31 100644 --- a/openlp-1to2-converter.py +++ b/openlp-1to2-converter.py @@ -1,5 +1,27 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### import sys import os diff --git a/openlp-get-strings.py b/openlp-get-strings.py new file mode 100644 index 000000000..0d4e3200a --- /dev/null +++ b/openlp-get-strings.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2009 Raoul Snyman # +# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten # +# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +import os +import sys +import re + +ts_file = u""" + + +%s + +""" +ts_context = u""" + %s +%s +""" +ts_message = u""" + + %s + + +""" +find_trUtf8 = re.compile(r"trUtf8\(u'([\w]+)'\)", re.UNICODE) +strings = {} + +def parse_file(filename): + global strings + file = open(filename, u'r') + class_name = u'' + line_number = 0 + for line in file: + line_number += 1 + if line[:5] == u'class': + class_name = line[6:line.find(u'(')] + continue + for match in find_trUtf8.finditer(line): + key = u'%s-%s' % (class_name, match.group(1)) + if not key in strings: + strings[key] = [class_name, filename, line_number, match.group(1)] + file.close() + +def write_file(filename): + global strings + translation_file = u'' + translation_contexts = [] + translation_messages = [] + class_name = strings[strings.keys()[0]][0] + current_context = u'' + for key, translation in strings.iteritems(): + if class_name != translation[0]: + current_context = ts_context % (class_name, u''.join(translation_messages)) + translation_contexts.append(current_context) + translation_messages = [] + class_name = translation[0] + translation_messages.append(ts_message % (translation[1], translation[2], translation[3])) + current_context = ts_context % (class_name, u''.join(translation_messages)) + translation_contexts.append(current_context) + translation_file = ts_file % (u''.join(translation_contexts)) + file = open(filename, u'w') + file.write(translation_file) + file.close() + +def main(): + start_dir = u'/home/raoul/Projects/openlp/i18n' + for root, dirs, files in os.walk(start_dir): + for file in files: + if file.endswith(u'.py'): + print u'Parsing "%s"' % file + parse_file(os.path.join(root, file)) + print u'Generating TS file...', + write_file(os.path.join(start_dir, u'i18n', u'openlp_en.ts')) + print u'done.' + +if __name__ == u'__main__': + main()