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

date formatting with ICU #14

Closed
SCastaneda opened this issue Feb 17, 2020 · 4 comments
Closed

date formatting with ICU #14

SCastaneda opened this issue Feb 17, 2020 · 4 comments

Comments

@SCastaneda
Copy link

Hi,
I've started using i18next with ICU and it works great with plurals. So first of thanks for this library!

One problem I encountered is that when I try to use date formatting via {x, date, short}, I currently only get some formatting into what mostly looks like ISO, but in some cases like Latvian for example, I'm getting result "2022 M11 14", when really what was expected is "14.11.2022".

The project is using node 8.10.0, Typescript (and yarn 1.21.1).
(Pushing to update node version is not possible)

I see that when you don't use ICU, you have formatting options as part of init via interpolation, but the syntax is completely different from ICU, using double {{}} and providing the format itself. Is there something similar we could use for ICU?

What I need is the user friendly short version for each translation, as mentioned above 👆.
Best case would be if translators would not have to provide formatting of date.

Thanks!

@jamuhl
Copy link
Member

jamuhl commented Feb 17, 2020

We just use the module done by formatjs - https://github.com/formatjs/formatjs/tree/master/packages/intl-messageformat

so we just use that ICU parser from there - nothing more - I can't give you any details on how to use it for your formatting request (as I never used it myself - just gave the option to use ICU messageformat with i18next - personally I will only maintain i18next's main format)...

@dyniper
Copy link

dyniper commented Feb 17, 2020 via email

@SCastaneda
Copy link
Author

I figured out that the issue is that our project isn't using full-icu:
nodejs/node#3460

Looks like you have to install full-icu, which provides you with some binary that you have to reference either with an ENV variable NODE_ICU_DATA or via --icu-data-dir flag.

Looks like they made it a default as part of 13.8: nodejs/node@1a25e90

@SCastaneda
Copy link
Author

I'll close this, as it isn't really your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants