From ece5b74dae3c2344f4d007953536edf9b6afc44a Mon Sep 17 00:00:00 2001 From: Atri Bhattacharya Date: Tue, 26 Jul 2016 00:09:17 +0200 Subject: [PATCH 1/3] Add name and summary to appdata file. Mark summary for translation. --- src/calibre/linux.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index ea2463c9c4..f36fea70c5 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -1032,6 +1032,7 @@ def get_appdata(): _ = lambda x: x # Make sure the text below is not translated, but is marked for translation return { 'calibre-gui': { + 'summary':( _('The one stop solution to all your e-book needs.') ), 'description':( _('calibre is the one stop solution to all your e-book needs.'), _('You can use calibre to catalog your books, fetch metadata for them automatically, convert them from and to all the various ebook formats, send them to your e-book reader devices, read the books on your computer, edit the books in a dedicated e-book editor and even make them available over the network with the built-in content server. You can also download news and periodicals in e-book format from over a thousand different news and magazine websites.') # noqa @@ -1044,6 +1045,7 @@ def get_appdata(): }, 'calibre-ebook-edit': { + 'summary':( _('Edit the text and styles inside e-books.') ), 'description':( _('The calibre e-book editor allows you to edit the text and styles inside the book with a live preview of your changes.'), _('It can edit books in both the EPUB and AZW3 (kindle) formats. It includes various useful tools for checking the book for errors, editing the Table of Contents, performing automated cleanups, etc.'), # noqa @@ -1056,6 +1058,7 @@ def get_appdata(): }, 'calibre-ebook-viewer': { + 'summary':( _('Read e-books in over a dozen different formats.') ), 'description': ( _('The calibre e-book viewer allows you to read e-books in over a dozen different formats.'), _('It has a full screen mode for distraction free reading and can display the text with multiple columns per screen.'), @@ -1074,6 +1077,7 @@ def write_appdata(key, entry, base, translators): root = E.application( E.id(key + '.desktop', type='desktop'), E.licence('CC0'), + E.name('Calibre Ebook Reader'), E.description(), E.url('https://calibre-ebook.com', type='homepage'), E.screenshots(), @@ -1083,12 +1087,17 @@ def write_appdata(key, entry, base, translators): root[-1].append(s) root[-1][0].set('type', 'default') for para in entry['description']: - root[2].append(E.p(para)) + root[3].append(E.p(para)) for lang, t in translators.iteritems(): tp = t.ugettext(para) if tp != para: - root[2].append(E.p(tp)) - root[2][-1].set('{http://www.w3.org/XML/1998/namespace}lang', lang) + root[3].append(E.p(tp)) + root[3][-1].set('{http://www.w3.org/XML/1998/namespace}lang', lang) + root.append(E.summary(entry['summary'])) + for lang, t in translators.iteritems(): + tp = t.ugettext(entry['summary']) + root.append(E.summary(tp)) + root[-1].set('{http://www.w3.org/XML/1998/namespace}lang', lang) with open(fpath, 'wb') as f: f.write(tostring(root, encoding='utf-8', xml_declaration=True, pretty_print=True)) return fpath From 5c38d151fb44c6d2f773198c1c87db7e9797ec3d Mon Sep 17 00:00:00 2001 From: Atri Bhattacharya Date: Tue, 26 Jul 2016 01:02:51 +0200 Subject: [PATCH 2/3] Different name fields for each appdata entry. --- src/calibre/linux.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index f36fea70c5..72cacf2a14 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -1032,6 +1032,7 @@ def get_appdata(): _ = lambda x: x # Make sure the text below is not translated, but is marked for translation return { 'calibre-gui': { + 'name':( ('Calibre Ebook Reader') ), 'summary':( _('The one stop solution to all your e-book needs.') ), 'description':( _('calibre is the one stop solution to all your e-book needs.'), @@ -1045,6 +1046,7 @@ def get_appdata(): }, 'calibre-ebook-edit': { + 'name':( ('Calibre Ebook Editor') ), 'summary':( _('Edit the text and styles inside e-books.') ), 'description':( _('The calibre e-book editor allows you to edit the text and styles inside the book with a live preview of your changes.'), @@ -1058,6 +1060,7 @@ def get_appdata(): }, 'calibre-ebook-viewer': { + 'name':( ('Calibre Ebook Viewer') ), 'summary':( _('Read e-books in over a dozen different formats.') ), 'description': ( _('The calibre e-book viewer allows you to read e-books in over a dozen different formats.'), @@ -1077,7 +1080,7 @@ def write_appdata(key, entry, base, translators): root = E.application( E.id(key + '.desktop', type='desktop'), E.licence('CC0'), - E.name('Calibre Ebook Reader'), + E.name(entry['name']), E.description(), E.url('https://calibre-ebook.com', type='homepage'), E.screenshots(), From 5729f9ec6cf76264ac0c4b8dd9181ad97414324b Mon Sep 17 00:00:00 2001 From: Atri Bhattacharya Date: Tue, 26 Jul 2016 01:32:39 +0200 Subject: [PATCH 3/3] Strip '.' from end of summary. --- src/calibre/linux.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/linux.py b/src/calibre/linux.py index 72cacf2a14..beca50f08c 100644 --- a/src/calibre/linux.py +++ b/src/calibre/linux.py @@ -1033,7 +1033,7 @@ def get_appdata(): return { 'calibre-gui': { 'name':( ('Calibre Ebook Reader') ), - 'summary':( _('The one stop solution to all your e-book needs.') ), + 'summary':( _('The one stop solution to all your e-book needs') ), 'description':( _('calibre is the one stop solution to all your e-book needs.'), _('You can use calibre to catalog your books, fetch metadata for them automatically, convert them from and to all the various ebook formats, send them to your e-book reader devices, read the books on your computer, edit the books in a dedicated e-book editor and even make them available over the network with the built-in content server. You can also download news and periodicals in e-book format from over a thousand different news and magazine websites.') # noqa @@ -1047,7 +1047,7 @@ def get_appdata(): 'calibre-ebook-edit': { 'name':( ('Calibre Ebook Editor') ), - 'summary':( _('Edit the text and styles inside e-books.') ), + 'summary':( _('Edit the text and styles inside e-books') ), 'description':( _('The calibre e-book editor allows you to edit the text and styles inside the book with a live preview of your changes.'), _('It can edit books in both the EPUB and AZW3 (kindle) formats. It includes various useful tools for checking the book for errors, editing the Table of Contents, performing automated cleanups, etc.'), # noqa @@ -1061,7 +1061,7 @@ def get_appdata(): 'calibre-ebook-viewer': { 'name':( ('Calibre Ebook Viewer') ), - 'summary':( _('Read e-books in over a dozen different formats.') ), + 'summary':( _('Read e-books in over a dozen different formats') ), 'description': ( _('The calibre e-book viewer allows you to read e-books in over a dozen different formats.'), _('It has a full screen mode for distraction free reading and can display the text with multiple columns per screen.'),