-
Notifications
You must be signed in to change notification settings - Fork 171
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
Post age has no unit #539
Comments
I have to go to sleep, but I figured I'd share what I found - I tried 5 languages (English, Spanish, Polish, Korean, and Danish) and Polish was the only one that triggered this issue. What's interesting is that, of these languages, Polish is the only locale for which
For Polish, this override takes us to org.ocpsoft.prettytime.i18n.Resources_pl:L48, where only the number is returned:
as opposed to org.ocpsoft.prettytime.format.SimpleTimeFormat:L95, which is where we go when there is no override above.
Update: Okay, I got curious and tried Russian. It, too, has an override there, and it too has missing time units. So Double update: If you look at the Resources_*.java files for languages that have overrides vs. no overrides, you see that the ones that work properly (no override) are mostly just a big 2D array with mapped out values. I grepped in that directory and it seems like there should be 4 languages that will have this issue: Kazakh, Polish, Russian, and Slavic. |
I've filed a bug report with PrettyTime |
A bug in PrettyTime causes four languages to not get any time units when formatted. We can work around this by detecting an invalid prettyDate (rather than hardcoding a list of broken languages) and switching to English formatting instead. ocpsoft/prettytime#259 Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This might be happening because Polish has different plurals for different numbers. 1 sekunda, 2..4 sekundy, 5.. sekund |
It is already implemented for polish here: There's probably a bug hiding somewhere upd: Oh, ok, now i don't get why it was implemented but still returns simple String.valueOf in format override. Still looking into it |
sensiblepuffin already explained what's wrong. It's because those four languages override |
I see but i'm more curious how did it happen in the first place. There's issue that shows it working correctly in the newpipe some time ago: ocpsoft/prettytime#182 and nothing was changed in the code really since then in Resources_ru |
Ok i looked into it and i discovered that while "formatDuration" is not implemented correctly in russian (and probably other languages) - format that basically return "1 hour ago" and etc works fine - that's what they used in NewPipe instead of "format" method. This unit test of library works totally fine:
So just using "format" for these languages might be a better workaround |
I solved this issue for ru locale in this pull request: ocpsoft/prettytime#260 Methods "format*" and "decorate*" were behaving incorrectly with old implementation: "format*" was used to get string value of date and "decorate*" was used to do the rest of the stuff. Correct way is to implement "format*" to return something like "12 days" and "decorate*" to add " ago" or "in " suffix/prefix. |
This doesn't seem to be an issue anymore. |
** Jerboa Version **
0.0.33
Describe the bug
Post age has no unit - shows just a number without an indication whether that's seconds, minutes, hours etc.
To Reproduce
Happens every single time if my phone's language is set to Polish.
The text was updated successfully, but these errors were encountered: