Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(multi-language): support log translation (DE, EN) #410

Open
wants to merge 28 commits into
base: beta
Choose a base branch
from

Conversation

noppelmax
Copy link

As some of my colleges are having trouble with the german-only interface, I decided to translate it to english. I used python-i18n with YAML files therefore.

Regards,
Max

@timreibe timreibe changed the base branch from master to beta June 9, 2021 21:41
@noppelmax
Copy link
Author

Did I use master?! Sorry for that! That happens to me all the time!

Note: I'm no native english speaker. ;) So feel free to fix/optimize the translations.

@haslersn
Copy link
Contributor

haslersn commented Jun 9, 2021

I don't see any language files in the PR. Did you forget to add them?

@noppelmax
Copy link
Author

Sry missed them

@haslersn
Copy link
Contributor

haslersn commented Jun 9, 2021

Ich sehe bei diesem PR die Gefahr, dass er für die Maintainer den Wartungsaufwand unverhältnismäßig erhöht.

Andererseits finde ich dieses Feature sinnvoller als die GUI.

@timreibe
Copy link
Owner

timreibe commented Jun 9, 2021

Did I use master?! Sorry for that! That happens to me all the time!

macht nix, ich merge die PR's ab und zu in den Master anstatt in die Beta, deshalb versuche ich da immer direkt am Anfang drauf zu achten haha

edit: sorry, wollte nicht closen.

@timreibe timreibe closed this Jun 9, 2021
@timreibe timreibe reopened this Jun 9, 2021
@timreibe
Copy link
Owner

timreibe commented Jun 9, 2021

kann man irgendwie die Sprache einstellen?

i18n/i18n.en.yml Outdated Show resolved Hide resolved
i18n/i18n.de.yml Outdated Show resolved Hide resolved
main.py Show resolved Hide resolved
@noppelmax
Copy link
Author

Ich sehe bei diesem PR die Gefahr, dass er für die Maintainer den Wartungsaufwand unverhältnismäßig erhöht.

Andererseits finde ich dieses Feature sinnvoller als die GUI.

Jep. Die Gefahr besteht.

@noppelmax
Copy link
Author

kann man irgendwie die Sprache einstellen?

Der sollte automatisch die Systemsprache verwenden. Fallback is de

@noppelmax
Copy link
Author

Aber ich hab auch über ein argument nachgedacht: --lang=de

Co-authored-by: haslersn <sebastian.hasler@gmx.net>
@haslersn
Copy link
Contributor

haslersn commented Jun 9, 2021

Aber ich hab auch über ein argument nachgedacht: --lang=de

Systemsprache ist erst mal ok.

noppelmax and others added 2 commits June 9, 2021 23:52
Co-authored-by: haslersn <sebastian.hasler@gmx.net>
Co-authored-by: haslersn <sebastian.hasler@gmx.net>
@haslersn
Copy link
Contributor

haslersn commented Jun 9, 2021

Ich bekomme beim Ausführen:

Traceback (most recent call last):
  File "./main.py", line 530, in <module>
    i18n.load_path.append(os.path.join(PATH, "i18n"))
AttributeError: module 'i18n' has no attribute 'load_path'

@noppelmax
Copy link
Author

Ich finde das Feature genial - allerdings würde ich vorschlagen, dass man es selbst aktiviert mit einem argument wie vorgeschlagen und auch nur in der CLI, nicht im GUI. Es betrifft nur einen kleinen Nutzerkreis und wir sollten das System nach wie vor vom Wartungsaufwand möglichst simpel halten.

Mit GUI hab ich nichts am Hut. :)

@noppelmax
Copy link
Author

@haslersn Hat es mit den neuen Requirements geklappt? Oder immer noch load_path Probleme? Hab ein neues venv gemacht. requirements.txt ist vollständig.

@timreibe
Copy link
Owner

timreibe commented Jun 9, 2021

Bei mir ist alles auf Englisch, weil in den i18n-config "locale": "en" eingetragen ist. Wenn ich das manuell auf de ändere, sind die Anzeigen wieder auf deutsch.

image

@timreibe
Copy link
Owner

timreibe commented Jun 9, 2021

eah, moment ich probiere es mit deinem commit

edit: klappt, super!

@noppelmax
Copy link
Author

noppelmax commented Jun 9, 2021

Haben wir eine Möglichkeit alle Pfad mal durch zu rattern? Gibt es Unittest o.ä.? Nicht dass ich was kaputt gemacht hab...

@timreibe
Copy link
Owner

timreibe commented Jun 9, 2021

Haben wir eine Möglichkeit alle Pfad mal durch zu rattern? Gibt es Unittest o.ä.? Nicht dass ich was kaputt gemacht hab...

öh, nein gibts nicht haha. müssen wir so testen

@noppelmax
Copy link
Author

noppelmax commented Jun 9, 2021

Gibt es eine Beschreibung der API? Dann könnte ich evlt. bis Sonntagabend Unittest schreiben.

@timreibe
Copy link
Owner

timreibe commented Jun 9, 2021

Gibt es eine Beschreibung der API?

was genau meinst du damit?

@haslersn
Copy link
Contributor

haslersn commented Jun 9, 2021

@haslersn Hat es mit den neuen Requirements geklappt? Oder immer noch load_path Probleme? Hab ein neues venv gemacht. requirements.txt ist vollständig.

Ja, damit kann ich es ausführen. Allerdings läuft es auf deutsch, obwohl meine Systemsprache englisch ist.

Kannst du bitte den folgenden Patch anwenden (git apply datei-mit-dem-folgenden-inhalt) für die Nix-Nutzer:

diff --git a/shell.nix b/shell.nix
index 11e4449..fd142a4 100644
--- a/shell.nix
+++ b/shell.nix
@@ -61,6 +61,16 @@ let
         };
         doCheck = false;
       };
+
+      python-i18n = buildPythonPackage rec {
+        pname = "python-i18n";
+        version = "0.3.9";
+        src = fetchPypi {
+          inherit pname version;
+          sha256 = "1s74f7sgay30kj80pqx9aa74d0slwklfzjynzgmsgwsb6v9g75yz";
+        };
+        doCheck = false;
+      };
     };
   };
 in
@@ -77,6 +87,9 @@ mkShell {
       p.cloudscraper
       p.idna
       p.plyer
+      p.python-i18n
+      p.python-prctl
+      p.pyyaml
       p.selenium
       p.urllib3
     ]))

@haslersn
Copy link
Contributor

haslersn commented Jun 9, 2021

Gibt es eine Beschreibung der API?

Ne. Bei der hohen Entwicklungsgeschwindigkeit und der niedrigen Erfahrung der Contributors wäre das auch schwierig durchzusetzen.

Problematisch (im Hinblick auf Tests) kommt hinzu, dass diejenigen Funktionen, die mit dem Impfterminservice kommunizieren, wegen häufig auftretenden 429-Responses recht nichtdeterministisch sind.

@timreibe
Copy link
Owner

timreibe commented Jun 9, 2021

der niedrigen Erfahrung der Contributors

geben unser Bestes 🤡

… number of entries and is every key is present in every language file.
@timreibe timreibe changed the title Feature i18n (de,en Support) feature(multi-language): support log translation (DE, EN) Jun 9, 2021
@timreibe timreibe changed the title feature(multi-language): support log translation (DE, EN) feat(multi-language): support log translation (DE, EN) Jun 9, 2021
@noppelmax
Copy link
Author

noppelmax commented Jun 9, 2021

Patch ist drin. Außerdem hab ich ein einfach Testscript geschrieben um zumindest mal zu überprüfen ob in jeder Übersetzung die gleich Keys vorkommen und ob es gleich viele sind. Ordner: test

Falls ihr/wir das wo anders haben wollen einfach Bescheid geben.

Zwecks Unittests; Ok. Aber eine Pfadabdeckung sollte auch ohne API Beschreibung funktionieren. :) Mal sehen wann ich Zeit finde.

@noppelmax
Copy link
Author

  • --lang=en can now be used to set language to english.
  • The language can be set in the advanced settings (via l)
  • The currently selected language is highlighted here
  • I added a line to README.md to guide english-only user directly to the --lang=en option

@noppelmax
Copy link
Author

noppelmax commented Jun 9, 2021

My next ToDos:

  • Translate utils.py
  • Translate its.py
  • Translate kontaktdaten.py
  • Write Unittests

shell.nix Outdated Show resolved Hide resolved
Co-authored-by: haslersn <sebastian.hasler@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants