I received a task to fix the articles and forms of nouns for German sentences, I am new to grammatical agreement so I refer to "Caffe" demo.

Here is my code:

Text("Thanks for logging ^[\(article) \(noun)](inflect: true)")

German Localizable.strings:

"a" = "einer";

"apple" = "Apfel";
"banana" = "Banane";
"car" = "Auto";

"bruise" = "Bluterguss";

"Thanks for logging ^[%@ %@](inflect: true)" = "Vielen Dank für die Eingabe ^[%@ ^[%@](morphology: { partOfSpeech: \"noun\" })](inflect: true)";

For the testing nouns "apple", "banana" and "car" works as expected, but "bruise" does not inflected as Masculine. I asked native German and she said the correct sentence should be

"Vielen Dank für die Eingabe eines Blutergusses" //thanks for Simon's correction

output:
Screenshot 2024-07-27 at 3.11.32 PM

Is there any way to fix this or I should use other nouns? thanks!

unfortunately I can't help you with your question, but I have to say - as a native German speaker - the phrase

"Vielen Dank für die Eingabe eines Blutergusses"

is just so incredibly weird that I had to tell you so. :rofl: sorry. now you know.
(still an ok translation though)

also, I am pretty sure it should be "Blutergusses" in this case, so to me its seems whatever is doing the declination magic with the articles seems to simply not understand the word "Bluterguss".

to not be completely useless I can offer an alternative way out maybe:
bruise can also be translated as Prellung (having a closer meaning of contusion), maybe that works better.
(Bluterguss is very specifically a hematoma, and a tad more medical-sounding than "bruise" I would say - so does not quite have the same meaning.)

that concludes today's German lesson, I'll see myself out, Auf Wiedersehen.

15 Likes

Thank you very much for Simon's detailed reply. I would ask for the localization team for reviewing this case. I will continue update the project with grammatical agreement instead of translate them case by case.

Rephrase to "Prellung" is a solution and I tested in the code it can output "Vielen Dank für die Eingabe einer Prellung".

Not all sentences that are grammatically correct are semantically correct. Natural languages are notoriously difficult in that regard. A native speaker could help you avoiding issues arising from misleading phrasing.

2 Likes

Update

I tried to translate the sentences with DeepL and now Automatic grammar agreement works as expected:

new string key value:

"Thanks for logging ^[%@ %@](inflect: true)" = "Danke, dass du ^[%@ ^[%@](morphology: { partOfSpeech: \"noun\" })](inflect: true) protokolliert hast.";

result:

Screenshot 2024-07-29 at 11.43.38 AM