Skip to content
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

Doesn't work well in other languages #9

Open
clarkwinkelmann opened this issue Apr 6, 2021 · 2 comments
Open

Doesn't work well in other languages #9

clarkwinkelmann opened this issue Apr 6, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@clarkwinkelmann
Copy link
Member

Some of the text isn't translated in other languages when used with language packs.

The issue seems to be that we define additional keys for relativeTime, and since those keys aren't part of the standard DayJS, language packs don't translate it.

For example for seconds there is only s by default, but this extension ads ss, which won't be translated by any extension.

s: '%d seconds',
ss: 'a few seconds',

Bizarrely in the report here https://discuss.flarum.org/d/23211-friendsofflarum-real-time-date/22 it seems like the s translation defaults to English, while it should be the only one with a French translation available, and I'd expect ss to default to English 🤔

Translations registered by language pack https://github.com/qiaeru/lang-french/blob/bd0d01dc8fedbb04d8184b9ce9c892e874151a0a/locale/config.js#L23 which is copied verbatim from https://github.com/iamkun/dayjs/blob/dev/src/locale/fr.js

We should either use only translations available in the base DayJS, or gracefully fallback from "x seconds ago" to "a few seconds ago" if "x seconds ago" isn't translated in the current language.

@clarkwinkelmann clarkwinkelmann added the bug Something isn't working label Apr 6, 2021
@Ralkage
Copy link

Ralkage commented Apr 6, 2021

We should either use only translations available in the base DayJS, or gracefully fallback from "x seconds ago" to "a few seconds ago" if "x seconds ago" isn't translated in the current language.

@clarkwinkelmann which method do you prefer/suggest?

@clarkwinkelmann
Copy link
Member Author

I haven't studied this in enough details to really say.

It seems to me that DayJS should have a way to translate "x seconds", but from my quick look at the translation files, it doesn't seem they do.

That probably leaves a proper fallback the best option, but I'm not sure if that's easy to do, or if DayJS already tries to fallback to something when a key doesn't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants