From 98daa40bfd68feead53e66da0c843e7a63bab101 Mon Sep 17 00:00:00 2001 From: BasioMeusPuga Date: Mon, 19 Mar 2018 00:11:06 +0530 Subject: [PATCH] Implement internationalization support --- Lector.pro | 34 ++ lector/__main__.py | 10 +- resources/translations/Lector_de.ts | 610 ++++++++++++++++++++++++++++ resources/translations/Lector_es.ts | 610 ++++++++++++++++++++++++++++ resources/translations/Lector_hi.ts | 610 ++++++++++++++++++++++++++++ resources/translations/Lector_jp.ts | 610 ++++++++++++++++++++++++++++ resources/translations/Lector_zn.ts | 610 ++++++++++++++++++++++++++++ 7 files changed, 3091 insertions(+), 3 deletions(-) create mode 100644 Lector.pro create mode 100644 resources/translations/Lector_de.ts create mode 100644 resources/translations/Lector_es.ts create mode 100644 resources/translations/Lector_hi.ts create mode 100644 resources/translations/Lector_jp.ts create mode 100644 resources/translations/Lector_zn.ts diff --git a/Lector.pro b/Lector.pro new file mode 100644 index 0000000..dcaf3ba --- /dev/null +++ b/Lector.pro @@ -0,0 +1,34 @@ +# This file is a part of Lector, a Qt based ebook reader +# Copyright (C) 2017-2018 BasioMeusPuga + +# 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, either version 3 of the License, or +# (at your option) any later version. + +# 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, see . + +SOURCES += lector/__main__.py \ + lector/definitionsdialog.py \ + lector/metadatadialog.py \ + lector/models.py \ + lector/widgets.py \ + lector/library.py \ + lector/toolbars.py \ + lector/settingsdialog.py \ + resources/definitions.py \ + resources/settingswindow.py \ + resources/metadata.py \ + resources/mainwindow.py + +TRANSLATIONS += resources/translations/Lector_de.ts \ + resources/translations/Lector_es.ts \ + resources/translations/Lector_hi.ts \ + resources/translations/Lector_jp.ts \ + resources/translations/Lector_zn.ts diff --git a/lector/__main__.py b/lector/__main__.py index 4e942cb..6e380af 100755 --- a/lector/__main__.py +++ b/lector/__main__.py @@ -1228,11 +1228,15 @@ def main(): # Internationalization support translator = QtCore.QTranslator() - translation_file = f':/translations/Lector_{QtCore.QLocale.system().name()}.qm' - print(f'Localization: {QtCore.QLocale.system().name()}') - translator.load(translation_file) + translations_found = translator.load( + QtCore.QLocale.system(), ':/translations/Lector_') app.installTranslator(translator) + translations_out_string = '(Translations found)' + if not translations_found: + translations_out_string = '(No translations found)' + print(f'Locale: {QtCore.QLocale.system().name()}', translations_out_string) + form = MainUI() form.show() form.resizeEvent() diff --git a/resources/translations/Lector_de.ts b/resources/translations/Lector_de.ts new file mode 100644 index 0000000..20e50ab --- /dev/null +++ b/resources/translations/Lector_de.ts @@ -0,0 +1,610 @@ + + + + BookToolBar + + + View settings + + + + + Fullscreen + + + + + Add bookmark + + + + + Bookmarks + + + + + Reset profile + + + + + Font size + + + + + Increase padding + + + + + Decrease padding + + + + + Increase line spacing + + + + + Decrease line spacing + + + + + Left align text + + + + + Right align text + + + + + Center align text + + + + + Justify text + + + + + Background color + + + + + Zoom in + + + + + Zoom Out + + + + + Fit Width + + + + + Best Fit + + + + + Original size + + + + + Search... + + + + + Table of Contents + + + + + DefinitionsUI + + + No definitions found in + + + + + Dialog + + + Dialog + + + + + WERDS + + + + + Play pronunciation of root word + + + + + Settings + + + + + Library + + + + + Switches + + + + + Startup: Refresh library + + + + + Remember open files + + + + + Generate tags from files + + + + + Dictionary: + + + + + Cover shadows + + + + + Enabling reduces startup time and memory usage + + + + + Load covers only when needed + + + + + Greatly reduces page transition time at the cost of more memory + + + + + Cache comic / pdf pages + + + + + Restart to see changes + + + + + Icon theme: + + + + + Dar&k + + + + + &Light + + + + + Scan Library + + + + + Close + + + + + About + + + + + Edit metadata + + + + + Cover (click to change) + + + + + Title + + + + + Author + + + + + Year + + + + + Tags (comma separated) + + + + + Tags + + + + + OK + + + + + Cancel + + + + + Library + + + Author + + + + + Year + + + + + manually added + + + + + LibraryToolBar + + + Add book + + + + + Delete book + + + + + Library background color + + + + + Settings + + + + + View as covers + + + + + View as table + + + + + Filter library + + + + + Search for Title, Author, Tags... + + + + + Sort by + + + + + MainWindow + + + Lector + + + + + Library + + + + + Main_UI + + + Toggle distraction free mode (Ctrl + D) + + + + + Scan library + + + + + Add books to database + + + + + eBooks + + + + + Adding books... + + + + + Confirm deletion + + + + + Save changes and start library scan + + + + + Books + + + + + Start reading + + + + + Edit + + + + + Delete + + + + + Mark read + + + + + Mark unread + + + + + Manually Added + + + + + MetadataUI + + + Author + + + + + Year + + + + + PliantQGraphicsScene + + + Select new cover + + + + + Images + + + + + PliantQGraphicsView + + + Save page as... + + + + + Zoom in (+) + + + + + Zoom out (-) + + + + + Fit width (W) + + + + + Best fit (B) + + + + + Original size (O) + + + + + Toggle distraction free mode + + + + + PliantQTextBrowser + + + Define + + + + + Search + + + + + Toggle distraction free mode + + + + + SettingsUI + + + English + + + + + Spanish + + + + + Hindi + + + + + Save changes and start library scan + + + + + Library scan in progress... + + + + + Checking library folders + + + + + Parsing files + + + + + Tab + + + Bookmarks + + + + + New bookmark + + + + + Edit + + + + + Delete + + + + + TableProxyModel + + + Title + + + + + Author + + + + + Year + + + + + Last Read + + + + + Tags + + + + + Newest + + + + diff --git a/resources/translations/Lector_es.ts b/resources/translations/Lector_es.ts new file mode 100644 index 0000000..20e50ab --- /dev/null +++ b/resources/translations/Lector_es.ts @@ -0,0 +1,610 @@ + + + + BookToolBar + + + View settings + + + + + Fullscreen + + + + + Add bookmark + + + + + Bookmarks + + + + + Reset profile + + + + + Font size + + + + + Increase padding + + + + + Decrease padding + + + + + Increase line spacing + + + + + Decrease line spacing + + + + + Left align text + + + + + Right align text + + + + + Center align text + + + + + Justify text + + + + + Background color + + + + + Zoom in + + + + + Zoom Out + + + + + Fit Width + + + + + Best Fit + + + + + Original size + + + + + Search... + + + + + Table of Contents + + + + + DefinitionsUI + + + No definitions found in + + + + + Dialog + + + Dialog + + + + + WERDS + + + + + Play pronunciation of root word + + + + + Settings + + + + + Library + + + + + Switches + + + + + Startup: Refresh library + + + + + Remember open files + + + + + Generate tags from files + + + + + Dictionary: + + + + + Cover shadows + + + + + Enabling reduces startup time and memory usage + + + + + Load covers only when needed + + + + + Greatly reduces page transition time at the cost of more memory + + + + + Cache comic / pdf pages + + + + + Restart to see changes + + + + + Icon theme: + + + + + Dar&k + + + + + &Light + + + + + Scan Library + + + + + Close + + + + + About + + + + + Edit metadata + + + + + Cover (click to change) + + + + + Title + + + + + Author + + + + + Year + + + + + Tags (comma separated) + + + + + Tags + + + + + OK + + + + + Cancel + + + + + Library + + + Author + + + + + Year + + + + + manually added + + + + + LibraryToolBar + + + Add book + + + + + Delete book + + + + + Library background color + + + + + Settings + + + + + View as covers + + + + + View as table + + + + + Filter library + + + + + Search for Title, Author, Tags... + + + + + Sort by + + + + + MainWindow + + + Lector + + + + + Library + + + + + Main_UI + + + Toggle distraction free mode (Ctrl + D) + + + + + Scan library + + + + + Add books to database + + + + + eBooks + + + + + Adding books... + + + + + Confirm deletion + + + + + Save changes and start library scan + + + + + Books + + + + + Start reading + + + + + Edit + + + + + Delete + + + + + Mark read + + + + + Mark unread + + + + + Manually Added + + + + + MetadataUI + + + Author + + + + + Year + + + + + PliantQGraphicsScene + + + Select new cover + + + + + Images + + + + + PliantQGraphicsView + + + Save page as... + + + + + Zoom in (+) + + + + + Zoom out (-) + + + + + Fit width (W) + + + + + Best fit (B) + + + + + Original size (O) + + + + + Toggle distraction free mode + + + + + PliantQTextBrowser + + + Define + + + + + Search + + + + + Toggle distraction free mode + + + + + SettingsUI + + + English + + + + + Spanish + + + + + Hindi + + + + + Save changes and start library scan + + + + + Library scan in progress... + + + + + Checking library folders + + + + + Parsing files + + + + + Tab + + + Bookmarks + + + + + New bookmark + + + + + Edit + + + + + Delete + + + + + TableProxyModel + + + Title + + + + + Author + + + + + Year + + + + + Last Read + + + + + Tags + + + + + Newest + + + + diff --git a/resources/translations/Lector_hi.ts b/resources/translations/Lector_hi.ts new file mode 100644 index 0000000..20e50ab --- /dev/null +++ b/resources/translations/Lector_hi.ts @@ -0,0 +1,610 @@ + + + + BookToolBar + + + View settings + + + + + Fullscreen + + + + + Add bookmark + + + + + Bookmarks + + + + + Reset profile + + + + + Font size + + + + + Increase padding + + + + + Decrease padding + + + + + Increase line spacing + + + + + Decrease line spacing + + + + + Left align text + + + + + Right align text + + + + + Center align text + + + + + Justify text + + + + + Background color + + + + + Zoom in + + + + + Zoom Out + + + + + Fit Width + + + + + Best Fit + + + + + Original size + + + + + Search... + + + + + Table of Contents + + + + + DefinitionsUI + + + No definitions found in + + + + + Dialog + + + Dialog + + + + + WERDS + + + + + Play pronunciation of root word + + + + + Settings + + + + + Library + + + + + Switches + + + + + Startup: Refresh library + + + + + Remember open files + + + + + Generate tags from files + + + + + Dictionary: + + + + + Cover shadows + + + + + Enabling reduces startup time and memory usage + + + + + Load covers only when needed + + + + + Greatly reduces page transition time at the cost of more memory + + + + + Cache comic / pdf pages + + + + + Restart to see changes + + + + + Icon theme: + + + + + Dar&k + + + + + &Light + + + + + Scan Library + + + + + Close + + + + + About + + + + + Edit metadata + + + + + Cover (click to change) + + + + + Title + + + + + Author + + + + + Year + + + + + Tags (comma separated) + + + + + Tags + + + + + OK + + + + + Cancel + + + + + Library + + + Author + + + + + Year + + + + + manually added + + + + + LibraryToolBar + + + Add book + + + + + Delete book + + + + + Library background color + + + + + Settings + + + + + View as covers + + + + + View as table + + + + + Filter library + + + + + Search for Title, Author, Tags... + + + + + Sort by + + + + + MainWindow + + + Lector + + + + + Library + + + + + Main_UI + + + Toggle distraction free mode (Ctrl + D) + + + + + Scan library + + + + + Add books to database + + + + + eBooks + + + + + Adding books... + + + + + Confirm deletion + + + + + Save changes and start library scan + + + + + Books + + + + + Start reading + + + + + Edit + + + + + Delete + + + + + Mark read + + + + + Mark unread + + + + + Manually Added + + + + + MetadataUI + + + Author + + + + + Year + + + + + PliantQGraphicsScene + + + Select new cover + + + + + Images + + + + + PliantQGraphicsView + + + Save page as... + + + + + Zoom in (+) + + + + + Zoom out (-) + + + + + Fit width (W) + + + + + Best fit (B) + + + + + Original size (O) + + + + + Toggle distraction free mode + + + + + PliantQTextBrowser + + + Define + + + + + Search + + + + + Toggle distraction free mode + + + + + SettingsUI + + + English + + + + + Spanish + + + + + Hindi + + + + + Save changes and start library scan + + + + + Library scan in progress... + + + + + Checking library folders + + + + + Parsing files + + + + + Tab + + + Bookmarks + + + + + New bookmark + + + + + Edit + + + + + Delete + + + + + TableProxyModel + + + Title + + + + + Author + + + + + Year + + + + + Last Read + + + + + Tags + + + + + Newest + + + + diff --git a/resources/translations/Lector_jp.ts b/resources/translations/Lector_jp.ts new file mode 100644 index 0000000..20e50ab --- /dev/null +++ b/resources/translations/Lector_jp.ts @@ -0,0 +1,610 @@ + + + + BookToolBar + + + View settings + + + + + Fullscreen + + + + + Add bookmark + + + + + Bookmarks + + + + + Reset profile + + + + + Font size + + + + + Increase padding + + + + + Decrease padding + + + + + Increase line spacing + + + + + Decrease line spacing + + + + + Left align text + + + + + Right align text + + + + + Center align text + + + + + Justify text + + + + + Background color + + + + + Zoom in + + + + + Zoom Out + + + + + Fit Width + + + + + Best Fit + + + + + Original size + + + + + Search... + + + + + Table of Contents + + + + + DefinitionsUI + + + No definitions found in + + + + + Dialog + + + Dialog + + + + + WERDS + + + + + Play pronunciation of root word + + + + + Settings + + + + + Library + + + + + Switches + + + + + Startup: Refresh library + + + + + Remember open files + + + + + Generate tags from files + + + + + Dictionary: + + + + + Cover shadows + + + + + Enabling reduces startup time and memory usage + + + + + Load covers only when needed + + + + + Greatly reduces page transition time at the cost of more memory + + + + + Cache comic / pdf pages + + + + + Restart to see changes + + + + + Icon theme: + + + + + Dar&k + + + + + &Light + + + + + Scan Library + + + + + Close + + + + + About + + + + + Edit metadata + + + + + Cover (click to change) + + + + + Title + + + + + Author + + + + + Year + + + + + Tags (comma separated) + + + + + Tags + + + + + OK + + + + + Cancel + + + + + Library + + + Author + + + + + Year + + + + + manually added + + + + + LibraryToolBar + + + Add book + + + + + Delete book + + + + + Library background color + + + + + Settings + + + + + View as covers + + + + + View as table + + + + + Filter library + + + + + Search for Title, Author, Tags... + + + + + Sort by + + + + + MainWindow + + + Lector + + + + + Library + + + + + Main_UI + + + Toggle distraction free mode (Ctrl + D) + + + + + Scan library + + + + + Add books to database + + + + + eBooks + + + + + Adding books... + + + + + Confirm deletion + + + + + Save changes and start library scan + + + + + Books + + + + + Start reading + + + + + Edit + + + + + Delete + + + + + Mark read + + + + + Mark unread + + + + + Manually Added + + + + + MetadataUI + + + Author + + + + + Year + + + + + PliantQGraphicsScene + + + Select new cover + + + + + Images + + + + + PliantQGraphicsView + + + Save page as... + + + + + Zoom in (+) + + + + + Zoom out (-) + + + + + Fit width (W) + + + + + Best fit (B) + + + + + Original size (O) + + + + + Toggle distraction free mode + + + + + PliantQTextBrowser + + + Define + + + + + Search + + + + + Toggle distraction free mode + + + + + SettingsUI + + + English + + + + + Spanish + + + + + Hindi + + + + + Save changes and start library scan + + + + + Library scan in progress... + + + + + Checking library folders + + + + + Parsing files + + + + + Tab + + + Bookmarks + + + + + New bookmark + + + + + Edit + + + + + Delete + + + + + TableProxyModel + + + Title + + + + + Author + + + + + Year + + + + + Last Read + + + + + Tags + + + + + Newest + + + + diff --git a/resources/translations/Lector_zn.ts b/resources/translations/Lector_zn.ts new file mode 100644 index 0000000..20e50ab --- /dev/null +++ b/resources/translations/Lector_zn.ts @@ -0,0 +1,610 @@ + + + + BookToolBar + + + View settings + + + + + Fullscreen + + + + + Add bookmark + + + + + Bookmarks + + + + + Reset profile + + + + + Font size + + + + + Increase padding + + + + + Decrease padding + + + + + Increase line spacing + + + + + Decrease line spacing + + + + + Left align text + + + + + Right align text + + + + + Center align text + + + + + Justify text + + + + + Background color + + + + + Zoom in + + + + + Zoom Out + + + + + Fit Width + + + + + Best Fit + + + + + Original size + + + + + Search... + + + + + Table of Contents + + + + + DefinitionsUI + + + No definitions found in + + + + + Dialog + + + Dialog + + + + + WERDS + + + + + Play pronunciation of root word + + + + + Settings + + + + + Library + + + + + Switches + + + + + Startup: Refresh library + + + + + Remember open files + + + + + Generate tags from files + + + + + Dictionary: + + + + + Cover shadows + + + + + Enabling reduces startup time and memory usage + + + + + Load covers only when needed + + + + + Greatly reduces page transition time at the cost of more memory + + + + + Cache comic / pdf pages + + + + + Restart to see changes + + + + + Icon theme: + + + + + Dar&k + + + + + &Light + + + + + Scan Library + + + + + Close + + + + + About + + + + + Edit metadata + + + + + Cover (click to change) + + + + + Title + + + + + Author + + + + + Year + + + + + Tags (comma separated) + + + + + Tags + + + + + OK + + + + + Cancel + + + + + Library + + + Author + + + + + Year + + + + + manually added + + + + + LibraryToolBar + + + Add book + + + + + Delete book + + + + + Library background color + + + + + Settings + + + + + View as covers + + + + + View as table + + + + + Filter library + + + + + Search for Title, Author, Tags... + + + + + Sort by + + + + + MainWindow + + + Lector + + + + + Library + + + + + Main_UI + + + Toggle distraction free mode (Ctrl + D) + + + + + Scan library + + + + + Add books to database + + + + + eBooks + + + + + Adding books... + + + + + Confirm deletion + + + + + Save changes and start library scan + + + + + Books + + + + + Start reading + + + + + Edit + + + + + Delete + + + + + Mark read + + + + + Mark unread + + + + + Manually Added + + + + + MetadataUI + + + Author + + + + + Year + + + + + PliantQGraphicsScene + + + Select new cover + + + + + Images + + + + + PliantQGraphicsView + + + Save page as... + + + + + Zoom in (+) + + + + + Zoom out (-) + + + + + Fit width (W) + + + + + Best fit (B) + + + + + Original size (O) + + + + + Toggle distraction free mode + + + + + PliantQTextBrowser + + + Define + + + + + Search + + + + + Toggle distraction free mode + + + + + SettingsUI + + + English + + + + + Spanish + + + + + Hindi + + + + + Save changes and start library scan + + + + + Library scan in progress... + + + + + Checking library folders + + + + + Parsing files + + + + + Tab + + + Bookmarks + + + + + New bookmark + + + + + Edit + + + + + Delete + + + + + TableProxyModel + + + Title + + + + + Author + + + + + Year + + + + + Last Read + + + + + Tags + + + + + Newest + + + +