Fix for #227: Wrong grammatical case in german locale when formatting…#229
Fix for #227: Wrong grammatical case in german locale when formatting…#229obecker wants to merge 1 commit intoocpsoft:masterfrom
Conversation
…matting a list of durations Fix for the logic that adjusts the german grammatical case for some units in the `decorate` and `decorateUnrounded` methods. The new logic replaces all occurrences of words that need to be adjusted in the translated time string, the old logic did this only for single durations. This should also fix issue ocpsoft#220, because the new logic simply replaces plural words and doesn't check if the duration is a plural duration. Contains also a minor improvement in SimpleTimeFormat.isPlural() that prevents computing the same number twice.
|
Hey @obecker , this looks great! Thanks for the PR. I think your refactoring in SimpleTimeUnit also looks good. Good catch. Also, I believe you're correct that we should likely be using the Calendar for all unit tests (At which point it should be refactored into a shared class). I know that would be a BIG PR, but... if you're up for it... Also, if you do that, or other PRs, could you please use the Eclipse code formatting preferences provided at the root of this project? It would help keep things clean and standard. Much appreciated! |
|
Sorry, code format file is here: https://github.com/ocpsoft/common/blob/master/ocpsoft-eclipse-code-format.xml |
|
Merged. |
|
Thanks for merging and publishing a new release. Instead of asking everyone to follow the code formatting rules you may consider using a maven plugin that will enforce this. See #230 |
… a list of durations
Fix for the logic that adjusts the german grammatical case for some units in
the
decorateanddecorateUnroundedmethods.The new logic replaces all occurrences of words that need to be adjusted in the
translated time string, the old logic did this only for single durations.
This should also fix issue #220, because the new logic simply replaces plural words
and doesn't check if the duration is a plural duration.
Contains also a minor improvement in SimpleTimeFormat.isPlural() that prevents
computing the same number twice.