Code Monkey home page Code Monkey logo

dialect's Introduction

Dialect

A translation app for GNOME.

Dialect

Features

  • Translation based on Google Translate
  • Translation based on the LibreTranslate API, allowing you to use any public instance
  • Translation based on Lingva Translate API
  • Translation based on Bing
  • Translation based on Yandex
  • Translation history
  • Automatic language detection
  • Text to speech
  • Clipboard buttons

Installation

Flathub

Download on Flathub

AUR

Arch-based distro users can install from the AUR: dialect for the stable version or dialect-git for the latest git revision.

Fedora

Dialect is available for Fedora 33 and later:

sudo dnf install dialect

Debian

Dialect is available in Debian 12:

sudo apt-get install dialect

Building

Requirements

  • Python 3 python
  • PyGObject python-gobject
  • GTK4 gtk4
  • libadwaita (>= 1.4.0) libadwaita
  • libsoup (>= 3.0) libsoup
  • libsecret
  • GStreamer 1.0 gstreamer
  • Meson meson
  • Ninja ninja
  • gTTS python-gtts
  • Beautiful Soup python-beautifulsoup4

If official packages are not available for any of the python dependencies, you can install them from pip:

pip install gtts

Building from Git

git clone --recurse-submodules https://github.com/dialect-app/dialect.git
cd dialect
meson builddir --prefix=/usr/local
sudo ninja -C builddir install

For testing and development purposes, you may run a local build:

git clone --recurse-submodules https://github.com/dialect-app/dialect.git
cd dialect
meson builddir
meson configure builddir -Dprefix=$(pwd)/builddir/testdir
ninja -C builddir install
ninja -C builddir run

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Translations

Dialect has already been translated into many languages (see the translations repository file). Please help translate Dialect into more languages through Weblate.

Translation status

License

GNU General Public License 3 or later

dialect's People

Contributors

albanobattistella avatar alice-mkh avatar baarkerlounger avatar bertob avatar bilelmoussaoui avatar camelcasenick avatar cho2 avatar comradekingu avatar eson57 avatar etamuk avatar gi-lom avatar ingrownmink4 avatar jameswestman avatar jimmac avatar ksxgithub avatar libretto7 avatar meskobalazs avatar milotype avatar mufeedali avatar musicsd avatar nexeleriot avatar pervoj avatar rafaelmardojai avatar sonnyp avatar teackot avatar vistaus avatar weblate avatar xfgusta avatar yakushabb avatar yarons avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dialect's Issues

Search Provider doesn't work in Flatpak

Currently I don't have time to checkout this, but just noticed after installing exported .flatpak from GNOME builder.

I don't know if we need to own com.github.gi_lom.dialect.SearchProvider in the manifest, or if it's another issue.

Uninstall guide?

Tried to install this on macOS, it failed, then I realized there's no uninstall process. Not sure what's been installed on my system and where. I saw pip pulled a few things, I guess for now I just need to go through and manually remove them.

NameError: name 'XdgConfigHome' is not defined

I received this error after installing on Manjaro GNOME using my own PKGBUILD building from the latest commit:

Traceback (most recent call last):
  File "/usr/sbin/gnabel", line 24, in <module>
    SettingsFile = os.path.join(XdgConfigHome, 'gnabel', 'settings.json')
NameError: name 'XdgConfigHome' is not defined

Shouldn't ~/.local/share/gnabel/settings.json or ~/.config/gnabel/settings.json be created if it's not found?

Flatpak Issues

I am using Pop!_OS 20.04 with all the latest updates. The Flatpak version of the app does not seem to respect the Desktop Theme (other Flatpak apps all do - idk why this one does not). Also - the dark mode toggle does not change anything for me.

Thanks for the handy app though - it's very useful :)!

Thoughts about changing search behavior

What do you guys think about changing the search behavior? It's standard in messaging applications to use Ctrl+Enter for linebreaks and Enter for actually sending the message.

The current code for the current behavior is a dirty hack. I was rewriting some of the GTK code to make it simpler, so I came across this weird behavior and wanted to know what you all thought about it.

@gi-lom @KSXGitHub @rafaelmardojai

AUR package does not work with Manjaro

File "/usr/bin/dialect", line 33, in <module>
  from dialect import main
File "/usr/share/dialect/dialect/main.py", line 13, in <module>
  gi.require_version('Handy', '1')
File "/usr/lib/python3.8/site-packages/gi/__init__.py", line 132, in require_version
  raise ValueError('Namespace %s not available for version %s' %
ValueError: Namespace Handy not available for version 1
  • Installed from AUR.
  • OS: Manjaro latest.

About the icon

The icon.

Did you make it yourself? If possible, can you make an SVG icon instead? SVG is smaller in size yet infinitely scalable.

Show pinyin for Chinese translations

For Chinese language learners the Pinyin that shows up underneath the characters can be very helpful. Does the api expose that at all? It is shown in the below image nǐ hǎo. Thanks for creating this fantastic application!

image

Add preferences window

What preferences will we want to expose?

Some thoughts:

  • Option to enable automatic translation as you type (with some warning about API abuse)
  • Option to disable translation history?
  • Button to clear translation history?

Missing icons on live CD

So I tried install and run gnabel on EndeavourOS Live CD, and this is the result:

screenshot

I am not sure which dependencies are missing as I am not familiar with GTK development.

Do you have any idea, @fushinari?

String substitution in source code is error prone

I am referring to line 27 and 28 of install.sh
https://github.com/gi-lom/gnabel/blob/92e9ccb82650c26d5ef60fed10c0106cadf8cb3f/install.sh#L27-L28

Problems:

  • Future changes may cause errors.
  • Not verifiable: Most packaging system use checksum to verify the files, string substitution that varies depend on machines produces different checksum.
  • Not portable: User cannot simply copy-and-paste the code and expect it to work.

Suggestion:

  • Use some algorithm to find standard paths (e.g. find icon in ~/.icons/gnabel.png, /usr/share/icons/$ICON_THEME/gnabel.png, etc.).

Translation

"Do not translate the program name".
why?

suggestions

First very cool program, I hope you keep it up.

The install script is, a bit funky. Several suggestions.

  1. don't hardcode the location of both the icon and the settings file. If they are relative to your gnabel.py file you could get their locations pragmatically.
  2. don't put the settings file in the same location as the program as it may not be writable. Either create it at install or put it in a user folder such as .config
  3. don't use pip on a system install, it may cause issues with the system managed python, best to use a virtualenv

Also if you're interested I created an arch PKGBUILD which installs gnabel within a virtualenv. I am still using your source code updating which as I said could be eliminated.

"Did you mean" suggestion when misspelled text

UX would be much better and more comparable with web Google Translate interface, when you app would be able to provide "Did you mean" suggestions when text has wrong, misspelled words. I don't know whether API provides this information but IMHO without this kind of suggestion for end users the app has little sense for me.

Zrzut ekranu z 2020-10-17 15-21-14

Scrolling text area bleeds through rounded corners

Screenshot from 2020-10-16 03-22-45

Fixing this in a generic way is pretty complex, but what you can do is:

  1. Have margins on your text view, so that its background doesn't extend to the leftmost/rightmost 6px or however big your border-radius is;
  2. Round the scrollbar in css (don't forget about rtl though)

Network Failure on all translations

Any time I try to translate something, even when I specify the origin language, I get a network error and nothing happens. This started happening suddenly and without any change on my side. I think I read that this may be an upstream issue with py-googletrans but I didnt see any issues in that git project that matched this exactly.

Better appdata summary

The current summary "A translation app for GNOME" isn't great, because it mentions the target environment (imagine every iOS app mentioning that it targets iOS in the summary :D). It's fine to mention GNOME in the description, but the summary should be short and focus on what it can do for people, e.g. "Translate any language".

More general guidance here: https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/App-Metadata

Add DeepL backend

DeepL is insane good in translation quality (much better than Google Translate for many language pairs). Seems like they have API.

It will be nice to have a setting to switch between Google Translate and DeepL backends.

New icon

There could be a better icon more compliant with GNOME guidelines and more stylized.
If you have any suggestions, put them here

Common themes:

  • A globe
  • A latin and a Japanese letter
  • A book
  • A speech bubble

[Feature request] Add proxy setting

Hi.

This may be strange request from title ! But it's usefulness is that:

  1. unfortunately, there are certain situation in which even such sites like online translations are blocked ! In such cases this feature will be extremely useful ...
  2. to improve privacy of users, like utilizing Google via Tor network to avoid Google anti-privacy hanger....

If this feature accepted to be added as future enhancement, then it should allow SOCKS 5 proxy & should allow user to select UDP or TCP or automatic(UDP/TCP) protocol.

Thank you.

New maintainer

I had fun writing Dialect, but I discovered maintaining an app is not really my cup of tea considering all I'm doing now is merging pull requests :) so I think that for the project's sake a more active maintainer would be better. Any of you would lake to take care of it?

Don't embed desktop entry inside install.sh | Don't force user to reply too much on install.sh

Currently, content of desktop entry is embeded inside install.sh: https://github.com/gi-lom/gnabel/blob/92e9ccb82650c26d5ef60fed10c0106cadf8cb3f/install.sh#L31-L42

This method of installation is hard for packaging for various Linux distros where executing a shell script is not encouraged. The ideal format should require only copy-pasting files from package to destinations.

Suggestion:

  • Create a gnabel.desktop file outside of install.sh.
  • Replace Icon=${DEST_DIR}/gnabel/icon.png with just Icon=gnabel to enable icon theming.
  • Rename icon.png to gnabel.png.
  • Change install.sh to copy icon file to ~/.icon/gnabel.png.

Gstreamer issue :)

Hello 😀!

First of all, great app! (And WOW! GREAT rewrite !)

The story is... I wanted to package dialect for Fedora now that there's a stable release. But... I've unfortunately discovered a bug with Gstreamer...

$ dialect
Traceback (most recent call last):
  File "/usr/share/dialect/dialect/main.py", line 35, in do_activate
    self.window = DialectWindow(
  File "/usr/share/dialect/dialect/window.py", line 94, in __init__
    bus = self.player.get_bus()
AttributeError: 'NoneType' object has no attribute 'get_bus'

And then, no window appear. The program doesn't really crash either. But if I open another terminal and retype the command, while the other one is still running, I get this:
image

I cannot translate anything. Nothing works.

I think what happens here is quite clear, Gst.ElementFactory("playbin", "player") fails and return none, and can't create the rest of the window. When I retype the command, it forces the window to show itself, even if it's still incomplete.

So I think that « maybe it is just some Gstreamer plugin missing, right »? Well, no. gstreamer1-plugins-base is installed and installing all Gstreamer-related package (except one random one because it's too heavy) doesn't change anything :/.

But then, something weird happens. If I try to do sudo dialect... It works! I mean, since I'm using Wayland I still has no sound, but, at least, it can translate! So this seems to be some kind of permission issues?

Btw, the Flatpak version works.

libhandy UI

We need mockups and ideas for implementation of a libhandy-based Mobile user interface. It has to be usable both on mobile and desktop and should not feel out of place in either environments.

Translation

I'm sorry, I have been translating this program for almost two weeks, but I do not understand these three sentences to complete the translation. What are these?

Warning: You could get your IP banned by API abuse.

Translate Accel

The opposite accel will be used for new line.

Change the hiragana letter on app icon

I find the Japanese letter on the icon a bit weird. So is pronounced a and can be pronounced ji, zi, or di. Since dialect is a translator app, I think it more makes sense to translate D into instead of .

Question for meaning of one settings (regarding dialect.pot)

Hello!

I am working on the German translation of dialect and finished it 99%. :-)
But one thing I cannot understand.
String: "The opposite accel will be used for new line." I know what this is doing but I am confused about the word "opposite". Does that mean the live translation starts to work with the new input? So could it be "The live translation will be start with a new line."?

Kind regards

Auto-translation

The Google Translate website automatically produces translated text as user type input text. The Crow Translate application also has a checkbox to enable auto-translation.

It would be great if Gnabel has the same feature.

However, I suspect that Gnabel requests for translation synchronously. If this is true, it would freeze the GUI on every character user types, leading to bad experience, so you may need to convert your mechanism to asynchronous first.

[Feature request] Allow other online sources than Google translate

Hi.

Currently, your cute application allow translation from only one online site, Google translate. But there are other cute source for online translation & it will be very useful to add an option allowing user to select from several choices.

Example for other online translation sources are:
https://www.bing.com/translator/
https://translate.yandex.com/
https://www.translate.com/

Kindly, see which of them could be integrated with your application.

Best.

I have created a PKGBUILD and an AUR package

I have created a PKGBUILD and an AUR package. I have tested the AUR package with yay and it works perfectly.

@jjgalvez @fushinari Do you have any criticisms?

@gi-lom Since you are the author of this project, I am willing to transfer ownership of the AUR package if you are willing to maintain it (this would only make sense if you use Arch Linux). The publication of AUR package can be automated with GitHub Workflow, I am willing to help you with that too.

A network issue has occurred.

The text translation works, but there's an issue with voice dictation. This occurs with gTTS 2.1.1 + gTTS-token 1.1.3 and gTTS 2.1.2 / 2.2.0 / 2.2.1 + gTTS-token 1.1.4.

I'm using dialect-git 1.1.0.r12.gff51505 on Manjaro GNOME (unstable branch).

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/share/dialect/dialect/window.py", line 160, in load_lang_speech
    self.lang_speech = list(lang.tts_langs(tld='com').keys())
TypeError: tts_langs() got an unexpected keyword argument 'tld'

TTS audio should be downloaded and played asynchronously

Problem

Currently, whenever user clicks the "speaker" button, the GUI freezes until audio is downloaded and played. This is a bad user experience.

Suggestion

Use async and await to download and play audio.

Expected behavior:

  • When user first clicks the "speaker" button, the button should change its icon to "stop" (as in "play"/"pause"/"stop") and the application should begin downloading audio file from Google.
  • While audio is being downloaded or played, if user clicks the "stop" button, the downloading/playing process should be stopped, and the button should change its shape back to "speaker".
  • When audio finishes, the "stop" button should change its icon to back to "speaker".

P.S. I am inexperience in Python so I can't help you with this, sorry :(

Certain terms will fail to translate

The only example of such a term that I've noticed so far is "exye". Typing that will give you "error".

In addition, it seems to set the src language to "hten". Thankfully, Dialect seems to handle it pretty gracefully on launch.

I haven't looked into how or why this is happening due to lack of time, but I'll look into it later.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.