From b9ad2a39a693e8e12fac53094806e1f30fb5c28b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 14 Jul 2011 09:40:01 -0600 Subject: [PATCH] Add the strings for the standard Qt buttons to the calibre translations --- setup/translations.py | 20 ++++++- src/calibre/translations/calibre.pot | 82 +++++++++++++++++++++++++++- 2 files changed, 99 insertions(+), 3 deletions(-) diff --git a/setup/translations.py b/setup/translations.py index 2666bb9744..4f5b8cd417 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -8,10 +8,18 @@ __docformat__ = 'restructuredtext en' import os, tempfile, shutil, subprocess, glob, re, time, textwrap from distutils import sysconfig +from functools import partial from setup import Command, __appname__, __version__ from setup.build_environment import pyqt +def qt_sources(): + qtdir = glob.glob('/usr/src/qt-*')[-1] + j = partial(os.path.join, qtdir) + return list(map(j, [ + 'src/gui/widgets/qdialogbuttonbox.cpp', + ])) + class POT(Command): description = 'Update the .pot translation template' @@ -82,6 +90,8 @@ class POT(Command): time=time.strftime('%Y-%m-%d %H:%M+%Z')) files = self.source_files() + qt_inputs = qt_sources() + with tempfile.NamedTemporaryFile() as fl: fl.write('\n'.join(files)) fl.flush() @@ -93,6 +103,12 @@ class POT(Command): '--from-code=UTF-8', '--sort-by-file', '--omit-header', '--no-wrap', '-k__', ]) + subprocess.check_call(['xgettext', '-j', + '--default-domain=calibre', '-o', out.name, + '--from-code=UTF-8', '--sort-by-file', '--omit-header', + '--no-wrap', '-kQT_TRANSLATE_NOOP:2', + ] + qt_inputs) + with open(out.name, 'rb') as f: src = f.read() os.remove(out.name) @@ -102,7 +118,9 @@ class POT(Command): with open(pot, 'wb') as f: f.write(src) self.info('Translations template:', os.path.abspath(pot)) - return pot + + + return pot class Translations(POT): diff --git a/src/calibre/translations/calibre.pot b/src/calibre/translations/calibre.pot index 7f0c01b354..db3c6e6a32 100644 --- a/src/calibre/translations/calibre.pot +++ b/src/calibre/translations/calibre.pot @@ -5,8 +5,8 @@ msgid "" msgstr "" "Project-Id-Version: calibre 0.8.9\n" -"POT-Creation-Date: 2011-07-14 09:07+MDT\n" -"PO-Revision-Date: 2011-07-14 09:07+MDT\n" +"POT-Creation-Date: 2011-07-14 09:38+MDT\n" +"PO-Revision-Date: 2011-07-14 09:38+MDT\n" "Last-Translator: Automatically generated\n" "Language-Team: LANGUAGE\n" "MIME-Version: 1.0\n" @@ -4363,6 +4363,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/actions/help.py:16 #: /home/kovid/work/calibre/src/calibre/gui2/preferences/tweaks_ui.py:91 +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:670 msgid "Help" msgstr "" @@ -7250,6 +7251,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/dialogs/comments_dialog.py:24 #: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog.py:236 +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:649 msgid "&OK" msgstr "" @@ -7257,6 +7259,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog.py:237 #: /home/kovid/work/calibre/src/calibre/gui2/dialogs/tweak_epub_ui.py:65 #: /home/kovid/work/calibre/src/calibre/gui2/preferences/main.py:233 +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:658 msgid "&Cancel" msgstr "" @@ -11947,6 +11950,7 @@ msgid "" msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/preferences/search_ui.py:131 +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:652 msgid "&Save" msgstr "" @@ -12672,6 +12676,7 @@ msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/store/search_ui.py:114 #: /home/kovid/work/calibre/src/calibre/gui2/store/stores/mobileread/store_dialog_ui.py:79 #: /home/kovid/work/calibre/src/calibre/gui2/store/web_store_dialog_ui.py:63 +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:661 msgid "Close" msgstr "" @@ -13274,6 +13279,7 @@ msgid "Edit" msgstr "" #: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager_ui.py:65 +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:667 msgid "Reset" msgstr "" @@ -16074,6 +16080,78 @@ msgstr "" msgid "Do not download CSS stylesheets." msgstr "" +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:649 +msgid "OK" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:652 +msgid "Save" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:655 +msgid "Open" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:658 +msgid "Cancel" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:661 +msgid "&Close" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:664 +msgid "Apply" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:674 +msgid "Don't Save" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:676 +msgid "Close without Saving" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:678 +msgid "Discard" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:681 +msgid "&Yes" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:684 +msgid "Yes to &All" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:687 +msgid "&No" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:690 +msgid "N&o to All" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:693 +msgid "Save All" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:696 +msgid "Abort" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:699 +msgid "Retry" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:702 +msgid "Ignore" +msgstr "" + +#: /usr/src/qt-everywhere-opensource-src-4.7.2/src/gui/widgets/qdialogbuttonbox.cpp:705 +msgid "Restore Defaults" +msgstr "" + #: /home/kovid/work/calibre/resources/default_tweaks.py:12 msgid "Auto increment series index"