Add the strings for the standard Qt buttons to the calibre translations

This commit is contained in:
Kovid Goyal 2011-07-14 09:40:01 -06:00
parent 192e922260
commit b9ad2a39a6
2 changed files with 99 additions and 3 deletions

View File

@ -8,10 +8,18 @@ __docformat__ = 'restructuredtext en'
import os, tempfile, shutil, subprocess, glob, re, time, textwrap import os, tempfile, shutil, subprocess, glob, re, time, textwrap
from distutils import sysconfig from distutils import sysconfig
from functools import partial
from setup import Command, __appname__, __version__ from setup import Command, __appname__, __version__
from setup.build_environment import pyqt 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): class POT(Command):
description = 'Update the .pot translation template' description = 'Update the .pot translation template'
@ -82,6 +90,8 @@ class POT(Command):
time=time.strftime('%Y-%m-%d %H:%M+%Z')) time=time.strftime('%Y-%m-%d %H:%M+%Z'))
files = self.source_files() files = self.source_files()
qt_inputs = qt_sources()
with tempfile.NamedTemporaryFile() as fl: with tempfile.NamedTemporaryFile() as fl:
fl.write('\n'.join(files)) fl.write('\n'.join(files))
fl.flush() fl.flush()
@ -93,6 +103,12 @@ class POT(Command):
'--from-code=UTF-8', '--sort-by-file', '--omit-header', '--from-code=UTF-8', '--sort-by-file', '--omit-header',
'--no-wrap', '-k__', '--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: with open(out.name, 'rb') as f:
src = f.read() src = f.read()
os.remove(out.name) os.remove(out.name)
@ -102,7 +118,9 @@ class POT(Command):
with open(pot, 'wb') as f: with open(pot, 'wb') as f:
f.write(src) f.write(src)
self.info('Translations template:', os.path.abspath(pot)) self.info('Translations template:', os.path.abspath(pot))
return pot
return pot
class Translations(POT): class Translations(POT):

View File

@ -5,8 +5,8 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: calibre 0.8.9\n" "Project-Id-Version: calibre 0.8.9\n"
"POT-Creation-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:07+MDT\n" "PO-Revision-Date: 2011-07-14 09:38+MDT\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Automatically generated\n"
"Language-Team: LANGUAGE\n" "Language-Team: LANGUAGE\n"
"MIME-Version: 1.0\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/actions/help.py:16
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/tweaks_ui.py:91 #: /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" msgid "Help"
msgstr "" 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/comments_dialog.py:24
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/template_dialog.py:236 #: /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" msgid "&OK"
msgstr "" 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/template_dialog.py:237
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/tweak_epub_ui.py:65 #: /home/kovid/work/calibre/src/calibre/gui2/dialogs/tweak_epub_ui.py:65
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/main.py:233 #: /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" msgid "&Cancel"
msgstr "" msgstr ""
@ -11947,6 +11950,7 @@ msgid ""
msgstr "" msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/preferences/search_ui.py:131 #: /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" msgid "&Save"
msgstr "" 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/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/stores/mobileread/store_dialog_ui.py:79
#: /home/kovid/work/calibre/src/calibre/gui2/store/web_store_dialog_ui.py:63 #: /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" msgid "Close"
msgstr "" msgstr ""
@ -13274,6 +13279,7 @@ msgid "Edit"
msgstr "" msgstr ""
#: /home/kovid/work/calibre/src/calibre/gui2/viewer/bookmarkmanager_ui.py:65 #: /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" msgid "Reset"
msgstr "" msgstr ""
@ -16074,6 +16080,78 @@ msgstr ""
msgid "Do not download CSS stylesheets." msgid "Do not download CSS stylesheets."
msgstr "" 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 #: /home/kovid/work/calibre/resources/default_tweaks.py:12
msgid "Auto increment series index" msgid "Auto increment series index"