Skip to content

Commit

Permalink
Merge branch 'main' into new-providers-api
Browse files Browse the repository at this point in the history
  • Loading branch information
mufeedali authored Dec 11, 2023
2 parents 7789543 + c79a6c4 commit 1594612
Show file tree
Hide file tree
Showing 21 changed files with 482 additions and 156 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

### In Development
- Make text views font size configurable and temporally modify it with shortcuts or scroll
- Fix search provider always running in the background
- Allow opening language selector with keyboard shortcuts

### 2.2.0
- Refactored providers implementation to ease future features
- Added Lingva Text-to-speech support in addition to Google's
- Added Bing translation provider
Expand Down
14 changes: 0 additions & 14 deletions build-aux/flatpak/pypi-dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@
}
]
},
{
"name": "python3-dbus-python",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"dbus-python\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/b1/5c/ccfc167485806c1936f7d3ba97db6c448d0089c5746ba105b6eb22dba60e/dbus-python-1.2.18.tar.gz",
"sha256": "92bdd1e68b45596c833307a5ff4b217ee6929a1502f5341bae28fd120acf7260"
}
]
},
{
"name": "python3-gtts",
"buildsystem": "simple",
Expand Down
2 changes: 1 addition & 1 deletion data/app.drey.Dialect.desktop.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Comment=Translate between languages
Categories=Network;GTK;
Icon=@icon@
# Translators: These are search terms to find this application. Do NOT translate or localize the semicolons. The list MUST also end with a semicolon.
Keywords=translate;translation;
Keywords=translate;translation;Google Translate;LibreTranslate;Lingva Translate;Bing Microsoft Translator;Bing Translator;Microsoft Translator;Yandex Translate;
# Translators: Do NOT translate or transliterate this text (these are enum types)!
X-Purism-FormFactor=Workstation;Mobile;
7 changes: 7 additions & 0 deletions data/app.drey.Dialect.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
<!-- 0 = Ctrl+Enter | 1 = Enter -->
<default>0</default>
</key>
<key type="b" name="custom-default-font-size">
<default>false</default>
</key>
<key type="i" name="default-font-size">
<!-- 0 = User has never enabled custom default font size before -->
<default>0</default>
</key>

<child name="tts" schema="@[email protected]" />
<child name="translators" schema="@[email protected]" />
Expand Down
62 changes: 45 additions & 17 deletions data/app.drey.Dialect.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,31 @@
<li>Clipboard buttons</li>
</ul>
</description>
<url type="homepage">https://apps.gnome.org/app/app.drey.Dialect/</url>
<url type="homepage">https://apps.gnome.org/Dialect/</url>
<url type="bugtracker">https://github.com/dialect-app/dialect/issues/</url>
<url type="translate">https://hosted.weblate.org/engage/dialect/</url>
<url type="vcs-browser">https://github.com/dialect-app/dialect/</url>
<developer_name>The Dialect Authors</developer_name>
<content_rating type="oars-1.1" />

<launchable type="desktop-id">@[email protected]</launchable>
<translation type="gettext">dialect</translation>

<custom>
<value key="GnomeSoftware::key-colors">[(108, 236, 156), (0, 0, 0)]</value>
</custom>
<categories>
<category>Network</category>
<category>GTK</category>
</categories>
<keywords>
<keyword>translate</keyword>
<keyword>translation</keyword>
<keyword>Google Translate</keyword>
<keyword>LibreTranslate</keyword>
<keyword>Lingva Translate</keyword>
<keyword>Bing Microsoft Translator</keyword>
<keyword>Bing Translator</keyword>
<keyword>Microsoft Translator</keyword>
<keyword>Yandex Translate</keyword>
</keywords>

<screenshots>
<screenshot type="default">
Expand All @@ -49,16 +62,31 @@
</screenshot>
</screenshots>
<releases>
<release version="2.2.0" date="2023-11-16">
<description translatable="no">
<ul>
<li>Refactored providers implementation to ease future features</li>
<li>Added Lingva Text-to-speech support in addition to Google'ss</li>
<li>Added Bing translation provider</li>
<li>Added Yandex translation provider</li>
<li>Updated preferences window</li>
<li>Languages list now have localized sorting</li>
<li>Fixed Lingva Translate provider bugs</li>
<li>Updated translations</li>
<li>Fixed minor bugs</li>
</ul>
</description>
</release>
<release version="2.1.1" date="2022-10-22">
<description>
<description translatable="no">
<ul>
<li>Updated translations</li>
<li>Fixed minor bugs</li>
</ul>
</description>
</release>
<release version="2.1.0" date="2022-10-18">
<description>
<description translatable="no">
<ul>
<li>Update to use libadwaita 1.2 widgets</li>
<li>Updated translations</li>
Expand All @@ -67,7 +95,7 @@
</description>
</release>
<release version="2.0.2" date="2022-07-17">
<description>
<description translatable="no">
<ul>
<li>Fixed responsive implementation</li>
<li>Fixed small stylings</li>
Expand All @@ -76,14 +104,14 @@
</description>
</release>
<release version="2.0.1" date="2022-07-14">
<description>
<description translatable="no">
<ul>
<li>Fixed an issue with scale factor</li>
</ul>
</description>
</release>
<release version="2.0.0" date="2022-07-13">
<description>
<description translatable="no">
<ul>
<li>Ported to GTK4 and libadwaita</li>
<li>New in-app color scheme switcher</li>
Expand All @@ -101,14 +129,14 @@
</description>
</release>
<release version="1.4.1" date="2021-10-20">
<description>
<description translatable="no">
<ul>
<li>Fix shortcut bug</li>
</ul>
</description>
</release>
<release version="1.4.0" date="2021-10-18">
<description>
<description translatable="no">
<ul>
<li>Added accels for most actions</li>
<li>Added localized language names</li>
Expand All @@ -118,7 +146,7 @@
</description>
</release>
<release version="1.3.0" date="2021-05-07">
<description>
<description translatable="no">
<ul>
<li>Backend refactor</li>
<li>Added option to disable Google TTS</li>
Expand All @@ -128,7 +156,7 @@
</description>
</release>
<release version="1.2.0" date="2021-03-08">
<description>
<description translatable="no">
<ul>
<li>Switch to a new icon</li>
<li>Added LibreTranslate backend</li>
Expand All @@ -140,7 +168,7 @@
</description>
</release>
<release version="1.1.1" date="2020-12-08">
<description>
<description translatable="no">
<ul>
<li>Added a shortcuts window</li>
<li>Added Indonesian translation</li>
Expand All @@ -150,7 +178,7 @@
</description>
</release>
<release version="1.1.0" date="2020-10-30">
<description>
<description translatable="no">
<ul>
<li>Added a search provider for GNOME</li>
<li>Added support for "Did you mean" suggestions</li>
Expand All @@ -167,7 +195,7 @@
</description>
</release>
<release version="1.0.0" date="2020-10-14">
<description>
<description translatable="no">
<p>Initial release.</p>
</description>
</release>
Expand All @@ -186,7 +214,7 @@
<control>touch</control>
</recommends>
<custom>
<value key="Purism::form_factor">workstation</value>
<value key="Purism::form_factor">mobile</value>
<value key="GnomeSoftware::key-colors">[(108, 236, 156), (0, 0, 0)]</value>
</custom>
</component>
8 changes: 4 additions & 4 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ appstream_file = i18n.merge_file(
install: true,
install_dir: join_paths(get_option('datadir'), 'metainfo')
)
appstream_util = find_program('appstream-util', required: false)
if appstream_util.found()
test('Validate appstream file', appstream_util,
args: ['validate-relax', appstream_file.full_path()]
appstreamcli = find_program('appstreamcli', required: false)
if appstreamcli.found()
test('Validate appstream file', appstreamcli,
args: ['validate', '--no-net', appstream_file.full_path()]
)
endif

Expand Down
2 changes: 1 addition & 1 deletion data/resources/about.blp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Adw.AboutWindow about {
destroy-with-parent: true;
application-name: _("Dialect");
developer-name: _("The Dialect Authors");
copyright: _("Copyright 2020–⁠2022 The Dialect Authors");
copyright: _("Copyright 2020–⁠2023 The Dialect Authors");
comments: _("A translation app for GNOME.");
website: "https://github.com/dialect-app/dialect";
issue-url: "https://github.com/dialect-app/dialect/issues";
Expand Down
29 changes: 29 additions & 0 deletions data/resources/preferences.ui
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,35 @@
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup">
<property name="title" translatable="yes">Appearance</property>
<child>
<object class="AdwExpanderRow" id="custom_default_font_size">
<property name="title" translatable="yes">Use Custom Font Size</property>
<property name="subtitle" translatable="yes">System font size is used otherwise.</property>
<property name="show-enable-switch">True</property>
<property name="enable-expansion">False</property>
<property name="expanded">True</property>
<child>
<object class="AdwSpinRow" id="default_font_size">
<property name="title" translatable="yes">Default Font Size</property>
<property name="subtitle" translatable="yes">Changing the size via shortcuts does not overwrite this.</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="lower">6</property>
<property name="upper">72</property>
<property name="value">0</property>
<property name="page-increment">10</property>
<property name="step-increment">5</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</template>
Expand Down
20 changes: 20 additions & 0 deletions data/resources/shortcuts.blp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ template $DialectShortcutsWindow : ShortcutsWindow {
action-name: "win.switch";
}

ShortcutsShortcut from_shortcut {
title: C_("shortcuts window", "Select source language");
action-name: "win.from";
}

ShortcutsShortcut to_shortcut {
title: C_("shortcuts window", "Select destination language");
action-name: "win.to";
}

ShortcutsShortcut {
title: C_("shortcuts window", "Clear source text");
action-name: "win.clear";
Expand All @@ -36,6 +46,16 @@ template $DialectShortcutsWindow : ShortcutsWindow {
title: C_("shortcuts window", "Show Pronunciation");
action-name: "app.pronunciation";
}

ShortcutsShortcut {
title: C_("shortcuts window", "Increase font size");
action-name: "win.font-size-inc";
}

ShortcutsShortcut {
title: C_("shortcuts window", "Decrease font size");
action-name: "win.font-size-dec";
}
}

ShortcutsGroup {
Expand Down
11 changes: 4 additions & 7 deletions data/resources/window.blp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ template $DialectWindow : Adw.ApplicationWindow {
centering-policy: strict;
title-widget: Stack title_stack {
transition-type: crossfade;
hhomogeneous: false;

StackPage {
name: "selector";
Expand Down Expand Up @@ -327,16 +328,13 @@ template $DialectWindow : Adw.ApplicationWindow {
ScrolledWindow {
vexpand: true;

TextView src_text {
wrap-mode: word_char;
$TextView src_text {
left-margin: 9;
right-margin: 9;
top-margin: 9;
bottom-margin: 9;

EventControllerKey src_key_ctrlr {
key-pressed => $_update_trans_button();
}
activate => $_on_src_activated();
}

styles [
Expand Down Expand Up @@ -460,9 +458,8 @@ template $DialectWindow : Adw.ApplicationWindow {
ScrolledWindow {
vexpand: true;

TextView dest_text {
$TextView dest_text {
editable: false;
wrap-mode: word_char;
left-margin: 9;
right-margin: 9;
top-margin: 9;
Expand Down
2 changes: 1 addition & 1 deletion dialect.doap
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<foaf:account>
<foaf:OnlineAccount>
<foaf:accountServiceHomepage rdf:resource="https://github.com/"/>
<foaf:accountName>fushinari</foaf:accountName>
<foaf:accountName>mufeedali</foaf:accountName>
</foaf:OnlineAccount>
</foaf:account>
</foaf:Person>
Expand Down
6 changes: 4 additions & 2 deletions dialect/languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@


def get_lang_name(code):
name = gettext(LANGUAGES.get(code, ''))
return name if name else None
name = LANGUAGES.get(code)
if name:
name = gettext(name)
return name


class LangObject(GObject.Object):
Expand Down
7 changes: 6 additions & 1 deletion dialect/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ def setup_actions(self):
self.set_accels_for_action('win.back', ['<Alt>Left'])
self.set_accels_for_action('win.forward', ['<Alt>Right'])
self.set_accels_for_action('win.switch', ['<Primary>S'])
self.set_accels_for_action('win.from', ['<Primary>F'])
self.set_accels_for_action('win.to', ['<Primary>T'])
self.set_accels_for_action('win.clear', ['<Primary>D'])
self.set_accels_for_action('win.font-size-inc', ['<Primary>plus', '<Primary>KP_Add'])
self.set_accels_for_action('win.font-size-dec', ['<Primary>minus', '<Primary>KP_Subtract'])
self.set_accels_for_action('win.paste', ['<Primary><Shift>V'])
self.set_accels_for_action('win.copy', ['<Primary><Shift>C'])
self.set_accels_for_action('win.listen-dest', ['<Primary>L'])
Expand Down Expand Up @@ -157,7 +161,8 @@ def _on_about(self, _action, _param):
about.props.version = VERSION
about.props.developers = [
"Mufeed Ali",
"Rafael Mardojai CM http://rafaelmardojai.com"
"Rafael Mardojai CM http://rafaelmardojai.com",
"Libretto"
]

about.props.transient_for = self.window
Expand Down
Loading

0 comments on commit 1594612

Please sign in to comment.