ocpsoft / prettytime

Social Style Date and Time Formatting for Java
http://ocpsoft.org/prettytime/
Apache License 2.0
1.29k stars 253 forks source link

Fix error in grammatical case for German translations #193

Closed hertg closed 3 years ago

hertg commented 4 years ago

This fixes the issues mentioned in the original post at #175.

However, the issue still persists when calling formatDuration(Duration) with a precise Duration that contains multiple units inside the same string.

E.g. The following test would still fail:

assertEquals("in 2 Monaten 4 Stunden 2 Minuten",
    prettyTime.format(prettyTime.calculatePreciseDuration(addTime(61, Calendar.DAY_OF_YEAR))));
Expected :in 2 Monaten 4 Stunden 2 Minuten
Actual   :in 2 Monate 4 Stunden 2 Minuten

I don't really understand why this even results in "in 2 months 4 hours 2 minutes", but I'm probably missing something.

That's because with the current API and without the necessary context information, this can't be solved without doing really dirty workarounds.

All the tests I've added run successfully. Funny enough, some of the others tests fail. But that was already the case before I applied my changes. Might be related to my system (?), would be good if anybody could take a look at that.

hertg commented 4 years ago

It looks like my IntelliJ IDEA did some whitespace-only changes to existing code when i hit the "reformat" shortcut.

In case you are not aware of that: You can hide the whitespace-only changes on the Github diff GUI, so only the changes that actually matter are highlighted :)

image

lincolnthree commented 3 years ago

@hertg Thank you very much for this PR, and my apologies for the delay! We've been busy getting our release of the new www.topdecked.com ready for public use, and a few things have slipped by.

Looking at this now.

lincolnthree commented 3 years ago

Looks great! All tests passing, and I agree with your changes. Merged!