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

Add German translation #2243

Draft
wants to merge 3 commits into
base: prepare-for-language-translations
Choose a base branch
from

Conversation

afh
Copy link
Member

@afh afh commented Apr 16, 2023

This PR adds a very first (read: bad) translation of Ledger's messages to ๐Ÿ‡ฉ๐Ÿ‡ช. As a native speaker I should be able to do a better job (and will). Yet my focus for this PR was to get an impression on all (~500 ๐Ÿ˜ฎโ€๐Ÿ’จ) the Ledger messages and the infrastructure to support international languages in Ledger.

I will look for inspiration from translationproject, oftentime when developing (and thinking) in English it is hard for me to switch back and forth to German when trying to come up with good translation.

Please see below for inline comments and context about the changes.

One thing to emphasise are the changes related to handling special metadata tags, e.g. Payee und UUID. Ledger currently allows these to be translated (and it does make sense) yet for compatibility I believe ledger should always recognize and support the English version.

This is a companion PR that stacks on top of #2242.

Tested using nix ๐Ÿฅณ:tada:

% nix run . -- reg
Error: No journal file was specified (please use -f)
% /usr/bin/env LC_MESSAGES=de nix run . -- reg
Fehler: Eine Journaldatei wurde nicht angegeben (bitte nutze -f)

TODO

  • Add tests
  • Improve translation

afh added 2 commits April 16, 2023 19:57
like "Payee" and "UUID" to maintain compatibilty
with existing journals when using a different locale
as prior to this change Ledger would only recognize
the translation of "Payee" or "UUID".
@afh afh added the enhancement New feature or request label Apr 16, 2023
@afh afh requested review from a team April 16, 2023 18:25
@afh afh self-assigned this Apr 16, 2023
@@ -126,6 +126,8 @@ string post_t::payee_from_tag() const
{
if (optional<value_t> post_payee = get_tag(_("Payee")))
return post_payee->as_string();
else if (optional<value_t> post_payee = get_tag("Payee"))
return post_payee->as_string();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume someone has a Ledger journal and has made use of the special metadata tag Payee. With the changes in this PR they are able to make Ledger speak German.

Without this change their journal would no longer recognize the English Payee keyword they have in their journal as Ledger would look for the German equivalent, i.e. Empfรคnger.

Therefore I believe Ledger should always support and recognize the English name of special metadata tags.

@@ -0,0 +1,2393 @@
# German translations for Ledger package.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Several words like commodity have not (yet) been translated. This was already quite a bit of work as it is and my brain went ๐Ÿ‘ป while thinking in English when working on this PR and switching to translation mode when expanding on this file.

@afh afh changed the title German translation Add German translation Apr 16, 2023
@afh afh mentioned this pull request Apr 16, 2023
1 task
@jwiegley
Copy link
Member

jwiegley commented Apr 18, 2023

Ich denke wirklich nicht, dass ich qualifiziert bin, um die รœbersetzungen speziell zu รผberprรผfen, obwohl ich die Code-ร„nderungen gutheiรŸe. Vielleicht kรถnnte ein anderer Muttersprachler einschreiten und seine Zustimmung geben, wenn es fertig ist?

@afh
Copy link
Member Author

afh commented Apr 19, 2023

Ich wusste gar nicht, daรŸ Du so gut Deutsch sprichst, John! HeiรŸt das, daรŸ ich die PR Beschreibungen zukรผnftig komplett in Deutsch schreiben kann? ๐Ÿ˜…

@jwiegley
Copy link
Member

Ach, es gab eine Zeit, in der ich das genossen hรคtte. Wรคhrend meiner Highschool- und Collegejahre habe ich mit groรŸer Intensitรคt Deutsch gelernt und wollte tatsรคchlich nach Deutschland ziehen, um dort als Programmierer zu arbeiten. Doch dann vergingen die Jahre und es gab zu wenig Gelegenheiten, die Sprache hier in den Staaten anzuwenden. Und realistisch betrachtet ist es viel effizienter, wenn Deutsche mit mir auf Englisch kommunizieren, als wenn ich meine brรผchigen Sprachkenntnisse an ihnen ausprobiere. Und so habe ich am Ende den GroรŸteil meiner Fรคhigkeiten verloren. Glรผcklicherweise ist ChatGPT ein groรŸartiger Assistent, der mir hilft, die Lรผcken zu fรผllen, wo das Vergessen mich eingeholt hat, und zumindest kann ich das Ergebnis Korrektur lesen und sicherstellen, dass ich nicht wie ein verrรผckter Mensch klinge.

And so yes, much better to continue in English, to avoid the inefficiency of translation getting in the way of a timely response. :)

@afh
Copy link
Member Author

afh commented Apr 19, 2023

I came across an article "[o]n writing better error messages" recently and feel somewhat inspired to re-work the existing messages Ledger prints.

My thinking is around coming up with a "scheme" for message-categories, i.e. how can error messages be differentiated linguistically from info messages.

How would you feel about a PR that may or may not rewrite the majority of Ledger's messages, @jwiegley?

โ„น๏ธ The article's essence is:

  • Who caused the error?
  • What happened, and why?
  • When will it be fixed?
  • How can the user respond to the error?

@jwiegley
Copy link
Member

Can you show me a few examples? That would better help me determine if the heavy lift is worth your time...

@afh
Copy link
Member Author

afh commented Apr 19, 2023

That is very considerate, @jwiegley, thank you. I believe it is worth the time to do soon, i.e. before folks volunteer to translate into other languages, as such a potentially large scale change will effectively require the re-translation.

Here are some quick examples:

Current Message Possibly Improved Message
Cannot add an uninitialized amount to an amount Initialize the uninitialized amount %1% with a value to add it to the amount %2%
Cannot add two uninitialized amounts Initialize the uninitialized amounts with a value to add them together
Cannot 'not' %1% The 'not' operator could not be applied to %1%
Error in the pager The pager program %1% exited with error status %2%

And maybe a first good take is consolidating use of 'Cannot' vs' Could not' and proper quoting of arguments within messages.

I just had an interesting idea: We could use gettext to get a feel for rewording by simply providing po/en.po with different messages ๐Ÿ˜†

@jwiegley
Copy link
Member

The latter two are definitely an improvement, but I find the top two to be more confusing. They don't directly inform the user about the mistake they made. By rephrasing it in terms of what would have worked, it can make the actual problem harder to spot...

@afh
Copy link
Member Author

afh commented Apr 19, 2023

That's helpful feedback, John, how about we direct our attention to getting #2242 merged first, then can have a look at potential changes to the English messages for wording and consistency, and then come back to this PR? Is this acceptable for you?

@jwiegley
Copy link
Member

Oh yes, that sounds great, Alexis! Good work you're doing here, and I think it will be helpful to many once we hammer it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants