X Tutup
Skip to content

Add German validation, parser, and scalar errors#2917

Closed
dondonz wants to merge 33 commits intomasterfrom
auf-deutsch
Closed

Add German validation, parser, and scalar errors#2917
dondonz wants to merge 33 commits intomasterfrom
auf-deutsch

Conversation

@dondonz
Copy link
Member

@dondonz dondonz commented Aug 14, 2022

Edit: this PR has been merged, but the GitHub UI says "closed".

Now that we have i18n for validation errors, let's try one more language!

Major health warning: my German level is abysmal and this PR was mostly written by Herr Google. I sincerely apologise in advance for the miserable translations in this PR.

Forgive me, I thought it would be easier to get the ball rolling with an open PR. Hopefully, you're sufficiently annoyed to start commenting :)

@dondonz dondonz added this to the 20.0 milestone Aug 19, 2022
@dondonz dondonz changed the title Add German validation errors Add German validation, parser, and scalar errors Sep 3, 2022
#InvalidSyntax.full=Ung\u00fcltige Syntax mit ANTLR-Fehler ''{0}'' in Zeile {1} Spalte {2}
#
#InvalidSyntaxBail.noToken=Ung\u00fcltige Syntax in Zeile {0} Spalte {1}
#InvalidSyntaxBail.full=Ung\u00fcltige Syntax mit ung\u00fcltigem Token ''{0}'' in Zeile {1} Spalte {2}
Copy link
Member Author

Choose a reason for hiding this comment

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

In English, the phrase here is "offending token". I wasn't sure if the direct translation of "offensive" can be used here.

I went with the word ungültig/invalid instead.

# Prior to Java 9, properties files are encoded in ISO-8859-1.
# We have to use \u00fc instead of the German ue character, \u00e4 for ae, \u00f6 for oe, \u00df for ss
#
# TODO: uncomment these messages after the default (English) Parsing bundle is merged in
Copy link
Member Author

Choose a reason for hiding this comment

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

Uncomment these messages after #2921 is merged in.

#2921 contains the default parsing bundle

# so use 2 '' characters to make it one ' on output. This will take for the form ''{0}''
#
Scalar.unexpectedAstType=Expected an AST type of ''{0}'' but it was a ''{1}''.
Scalar.unexpectedAstType=Expected an AST type of ''{0}'' but it was a ''{1}''
Copy link
Member Author

Choose a reason for hiding this comment

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

Nit: all the default validation messages did not end in a trailing full stop, so removing for consistency

when:
def message = i18n.msg("ExecutableDefinitions.notExecutableType")
then:
message == "Validierungsfehler ({0}) : Die Typdefinition '{1}' ist nicht ausführbar"
Copy link
Member Author

Choose a reason for hiding this comment

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

This test is important to verify \u00fc was parsed correctly as ü

@bbakerman
Copy link
Member

The Parser i18n code is now master - so there is more i18n keys to translate

@dondonz
Copy link
Member Author

dondonz commented Oct 14, 2022

The Parser i18n code is now master - so there is more i18n keys to translate

I added them already (commented out) https://github.com/graphql-java/graphql-java/pull/2917/files#r962109513

# We have to use \u00fc instead of the German ue character, \u00e4 for ae, \u00f6 for oe, \u00df for ss
#
InvalidSyntax.noMessage=Ung\u00fcltige Syntax in Zeile {0} Spalte {1}
InvalidSyntax.full=Ung\u00fcltige Syntax mit ANTLR-Fehler ''{0}'' in Zeile {1} Spalte {2}
Copy link
Member

Choose a reason for hiding this comment

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

"Mit" sounds a bit strange, but not totally wrong. Maybe just a comma after "Syntax"?

InvalidSyntax.full=Ung\u00fcltige Syntax mit ANTLR-Fehler ''{0}'' in Zeile {1} Spalte {2}

InvalidSyntaxBail.noToken=Ung\u00fcltige Syntax in Zeile {0} Spalte {1}
InvalidSyntaxBail.full=Ung\u00fcltige Syntax mit ung\u00fcltigem Token ''{0}'' in Zeile {1} Spalte {2}
Copy link
Member

Choose a reason for hiding this comment

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

I would recommend "wegen" which means "because of" instead of "mit"

Choose a reason for hiding this comment

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

Nur als Hinweis: Das Wort "wegen" hat den Genitiv zur Folge

-> Ungültige Syntax wegen des ungültigen Tokens X .......

Copy link
Member Author

Choose a reason for hiding this comment

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

Danke!

#
ParseCancelled.full=Es wurden mehr als {0} ''{1}'' Token pr\u00e4sentiert. Um Denial-of-Service-Angriffe zu verhindern, wurde das Parsing abgebrochen
#
InvalidUnicode.trailingLeadingSurrogate=Ung\u00fcltiger Unicode gefunden. Nachfolgendes Surrogat muss ein f\u00fchrendes Surrogat vorangestellt werden. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}
Copy link
Member

Choose a reason for hiding this comment

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

Honestly I am struggling here: not really wrong, but I would not translate it into "nachfolgend" . Leading and traling surrogate should not be translated.

#
InvalidUnicode.trailingLeadingSurrogate=Ung\u00fcltiger Unicode gefunden. Nachfolgendes Surrogat muss ein f\u00fchrendes Surrogat vorangestellt werden. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}
InvalidUnicode.leadingTrailingSurrogate=Ung\u00fcltiger Unicode gefunden. Auf ein f\u00fchrendes Surrogat muss ein abschlie\u00dfendes Surrogat folgen. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}
InvalidUnicode.invalidCodePoint=Ung\u00fcltiger Unicode gefunden. Kein g\u00fcltiger Codepunkt. Ung\u00fcltiges Token ''{0}'' in Zeile {1} Spalte {2}
Copy link
Member

Choose a reason for hiding this comment

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

I would not translate codepoint.

# Prior to Java 9, properties files are encoded in ISO-8859-1.
# We have to use \u00fc instead of the German ue character, \u00e4 for ae, \u00f6 for oe, \u00df for ss
#
Scalar.unexpectedAstType=Erwartet wurde ein AST-Typ von ''{0}'', aber es war ein ''{1}''
Copy link
Member

Choose a reason for hiding this comment

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

AST Type should not be translated imho

Choose a reason for hiding this comment

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

Sofern man den AST-Type doch übersetzen wollen würde, wären folgende Optionen denkbar.

  • Erwartet wurde ein AST-Typ vom Typ X, jedoch war dieser Typ ein Y
  • Erwartet wurde DER AST-Typ X, es kam aber ein AST-Typ Y.

Sofern man den - wie von @andimarek vorgeschlagen - AST-Typ weglassen möchte, könnte man das ganze so schreiben:

  • Erwartet wurde X, gekommen ist aber Y

Was will ich damit sagen? Dass das "es war ein....." nicht passt, da das Wort "erwarten" in diesem Zusammenhang ein "kommen" fordert.

Ich erwartete @dondonz , es kam aber @andimarek
Ich erwartete @dondonz , es war aber @andimarek (, der gekommen ist)
Ohne das, was in Klammern steht, würde der Satz so nicht funktionieren.

Etwas unkritischer ist folgendes zu sehen, wenn ich vorher noch einen abstrakten Klassifizierer einbaue.

Ich erwartete die Person @dondonz , aber die Person war @andimarek (,die dafür sorgte, dass meine Erwartungshaltung nicht eingehalten worden ist^^)
In dem Fall bezieht sich das "aber (die Person)" nur auf das Unterobjekt von Person aus dem vorhergehenden Hauptsatz.

Soviel zu dem Versuch, mein Sprachgefühl etwas zu Papier zu bekommen.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @knotenpunkt, thanks for your comments on this PR, I really do value having experts review this PR.

I thought German grammar was hard already but Denglisch grammar is beyond me! All these English words really mess with the grammar 😅. While I will be merging this PR as is soon, wanted to say I'm going to ask for more reviews of these strings and I will take your comments into account. I didn't want to block the PR while I ask for more reviews.

Forgive me for replying in English!

Int.notInt=Erwartet wurde ein Wert, der in den Typ ''Int'' konvertiert werden kann, aber es war ein ''{0}''
Int.outsideRange=Erwarteter Wert im Integer-Bereich, aber es war ein ''{0}''
#
ID.notId=Erwartet wurde ein Wert, der in den Typ ''ID'' umgewandelt werden kann, aber es war ein ''{0}''
Copy link
Member

Choose a reason for hiding this comment

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

I recommend above not to translate AST type, but this would probably also mean not to translate type. I am on the fence about that.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll retain Typ here as it's a standalone word.

Choose a reason for hiding this comment

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

Also mir gefällt das mit dem "aber es war" nicht wirklich gut, aus den Gründen, die ich bereits zu einem anderen Reviewpunkt geschrieben habe.
Außerdem bezieht sich das "aber" in der Regel auch meistens auf den kompletten vorherigen Satz und nicht unbedingt nur auf einzelne Objekte. Der ganze vorherige Satz soll damit "relativiert" werden. Möchte man sich nur einem bestimmten Objekt aus dem vorherigen Satz beziehen und diesem widersprechen bzw. "relativieren", dann sollte man es in Kombination mit dem aber referenzieren.
Das heißt:

Erwartet wurde ein Wert, der in Typ Int konveritert werde kann, aber dieser Typ war ein String
vllt. noch etwas schöner: ......, aber dieser Typ war vom Typ String (naja gut ist glaube ich Geschmackssache^^)

Und was ich persönlich noch etwas schöner finde, ist das "aber" nicht direkt an den Anfang des zweiten Hauptsatzes zu stellen, sondern etwas weiter hinein, so wird diese Referenzierung außerdem och etwas klarer erkennbar.

-> Erwartet wurde ein Wert, der in den Typ int konvertiert werde kann, DIESER war ABER vom Typ String

Und wenn man es noch etwas poetischer haben möchte, dann wäre auch folgendes eine Option:

Erwartet wurde......, DIESER ABER war vom Typ String
Gramatikalisch gesehen ist diese Variante im deutschen vermutlich gar nicht erlaubt; was aber nicht heißt, dass man die Regeln nicht doch vllt. an der ein oder anderen Stelle etwas beugen darf oder vllt. sollte^^

# Prior to Java 9, properties files are encoded in ISO-8859-1.
# We have to use \u00fc instead of the German ue character, \u00e4 for ae, \u00f6 for oe, \u00df for ss
#
ExecutableDefinitions.notExecutableType=Validierungsfehler ({0}) : Die Typdefinition ''{1}'' ist nicht ausf\u00fchrbar
Copy link
Member

Choose a reason for hiding this comment

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

I would not translate any GraphQL specific terms like type definition, schema definition etc.

Choose a reason for hiding this comment

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

@andimarek warum eigentlich nicht?^^ Ich hatte damals einen Prof an der UNI, bei dem kam kein einziges englisches Wort mehr vor. So wurden bspw. auch Threads zu Fäden übersetzt, Scheduler zu Ablaufplaner usw....
Aber davon mal abgesehen, warum meinst du, dass wir hier die englischen Begriffe beibehalten sollten

-> Validierungsfehler X: Die "type definition" Y ist nicht ausführtbar?

Copy link
Member Author

Choose a reason for hiding this comment

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

The choice between German and English terms for GraphQL specific words is a tough one.

I'm going to retain English terms for GraphQL specific words, as that's what I've seen elsewhere such as in Nils' Spring for GraphQL course, and more often I have seen English terms in German university computer science courses.

#
FieldsOnCorrectType.unknownField=Validierungsfehler ({0}) : Feld ''{1}'' vom Typ ''{2}'' ist nicht definiert
#
FragmentsOnCompositeType.invalidInlineTypeCondition=Validierungsfehler ({0}) : Die Bedingung f\u00fcr den Inline-Fragmenttyp ist ung\u00fcltig, muss auf Objekt/Schnittstelle/Union stehen
Copy link
Member

Choose a reason for hiding this comment

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

same here: lets not translate inline fragment, object/interface/untion.

LoneAnonymousOperation.withOthers=Validierungsfehler ({0}) : Anonyme Operation mit anderen Operationen
LoneAnonymousOperation.namedOperation=Validierungsfehler ({0}) : Operation ''{1}'' folgt der anonymen Operation
#
NoFragmentCycles.cyclesNotAllowed=Validierungsfehler ({0}) : Fragmentzyklen nicht erlaubt
Copy link
Member

Choose a reason for hiding this comment

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

Fragmentzyklen looks really odd for me ... If you want to translate it, I would probably make two words out of it.

#
OverlappingFieldsCanBeMerged.differentFields=Validierungsfehler ({0}) : ''{1}'' : ''{2}'' und ''{3}'' sind unterschiedliche Felder
OverlappingFieldsCanBeMerged.differentArgs=Validierungsfehler ({0}) : ''{1}'' : Felder haben unterschiedliche Argumente
OverlappingFieldsCanBeMerged.differentNullability=Validierungsfehler ({0}) : ''{1}'' : Felder haben unterschiedliche Nullbarkeitsformen
Copy link
Member

Choose a reason for hiding this comment

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

Lets not translate Nullbarkeitsformen or Listenformen ... I believe this is more confusing than the english word

@dondonz dondonz requested a review from andimarek October 24, 2022 23:35
Copy link
Contributor

@jord1e jord1e left a comment

Choose a reason for hiding this comment

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

See below.

Copy link
Contributor

@jord1e jord1e left a comment

Choose a reason for hiding this comment

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

My German is crap (around A2) but I was able to read everything without a translator.
I don't know if there is any native German speakers around here (Andi I think🥲 ?).

dondonz and others added 4 commits October 27, 2022 15:31
Haben!

Co-authored-by: Jordie <30464310+jord1e@users.noreply.github.com>
* Add all Float and Double coercion exception cases

* Clean up tests, remove no longer allowed NaN value

* Add early return for Doubles

* Reorder NaN/Infinity check and add string representation to test

* Remove unnecessary NaN check

* Tidy package name

* Tidy up
…on-main-repo

Only run GCP tests on main graphql-java repo (skip on forks).
MayCXC and others added 15 commits October 29, 2022 14:38
* use ast builders and stub test

* remove main and add test

* restore jvm check

* revert test spacing

* fix test

* revers build.gradle

* use spec specifiedByURL capitalization

* update another specifiedByURL test

* refactor introspection query builder, restore and deprecate __Type.specifiedByUrl

* test that AST printed introspection query is equivalent to original string
* Avoid an allocation of a chained context in the most common case

* Avoid calling back to methods that create state parameters
* ImmutableKit cleanups

- adding @SafeVarargs to ImmutableKit
- dropping unused methods

* Migrating links to the spec to https://spec.graphql.org/October2021
* LambdaMetafactory support

Another PR on improving getter access

* LambdaMetafactory support

Fixed test where parameters are present

* LambdaMetafactory support

Benchmark fix up

* final fields

* Tweaked code from PR feedback
* SchemaGeneratorPostProcessing should be deprecated

* SchemaGeneratorPostProcessing should be deprecated - right date
* Remove unused imports and warnings from TwitterBenchmark

* Configure ParserOptions for TwitterBenchmark

* Fix javadoc of PersistedQueryCache
…plementations

Bugfix for SDL check if an Interface is implemented correctly
* An error builder on GraphQLError

* An error builder on GraphQLError - wat

* ErrorClassification builder support

* ErrorClassification builder support - readme example

* ErrorClassification builder support - renamed method
Add German validation, parser, and scalar errors
@dondonz dondonz closed this Nov 13, 2022
@dondonz
Copy link
Member Author

dondonz commented Nov 13, 2022

Maybe I fat fingered it, the PR was merged but looks "closed"

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.

7 participants

X Tutup