intlify / vue-i18n

Vue I18n for Vue 3
https://vue-i18n.intlify.dev/
MIT License
2.2k stars 337 forks source link

Use `@formatjs/intl`? #93

Open longlho opened 4 years ago

longlho commented 4 years ago

πŸ‘‹ We just released @formatjs/intl that detaches the imperative API from the React binding (react-intl uses this basically) so I'm curious if vue-i18n-next can use it? It basically has everything that react-intl supports (custom formats, default timeZone, format merging, handling AST vs regular messages).

I'm curious what the roadmap for vue-i18n-next is as well?

No hard feelings if this doesn't happen πŸ˜„

kazupon commented 4 years ago

Hi πŸ‘‹

I know about your @formatjs. I'm very glad you're interested in my library or framework. ☺️

Here's the roadmap for vue-i18n-next also known as intlify. https://github.com/orgs/intlify/projects/1

The intlify project is an OSS project aimed at improving the DX of i18n and l10n.

I also understand the importance of i18n and I am educating others about it. (I'm not very good at English, though... πŸ˜… )

formatjs is great! because it also allows you to use the ECMA-402 API.

I would love to use formatjs in my intlify project as well, but I'd like to build the architecture and implementation with a full-scratch, zero-based mindset as much as possible.

longlho commented 4 years ago

gotcha understood πŸ˜„ feel free to reach out if u have questions

glen-84 commented 3 years ago

I'd love to see ICU Message syntax being the default, instead of the current non-standard syntax.

Have custom formatters been removed in vue-i18n-next? If so, why?

kazupon commented 3 years ago

Happy new year from japan!

Have custom formatters been removed in vue-i18n-next? If so, why?

Unfortunately, custom formatter is not supported in vue-i18n@v9 and later. 😞 In v9, I created a compiler for vue-i18n message format with full scratch. However, it is difficult and time-consuming to provide custom functionality for a message format like ICU, so we have abandoned support for it in v9.

In order for Vue.js to support i18n with ICU-like message format support, you will need to create a combination of formatjs and @vue/reactivity.

kazupon commented 3 years ago

I recognize that the syntax of the vue-i18n message format is proprietary. And I recognize that the syntax of the vue-i18n message format is proprietary, and I understand that it is difficult to integrate with existing localization services.

As the next roadmap for the Intlify project, the vue-i18n (intlify) message format will support compatibility with the ICU message format, or the standard message format specification that the unicode working group is working on.

longlho commented 3 years ago

MessageFormat v2 will take a least a few years to have some sort of a syntax. Then localization services will have to adopt that and adoption rate can be very slow. I wouldn't wait for it.

glen-84 commented 3 years ago

Happy new year from japan!

Happy new year. :tada:

Unfortunately, custom formatter is not supported in vue-i18n@v9 and later. 😞

That's really unfortunate. :disappointed:

However, it is difficult and time-consuming to provide custom functionality for a message format like ICU, so we have abandoned support for it in v9.

I thought that most of the work would be done by another library like formatjs, and you just needed to expose an API that allowed users to handle a formatMessage(message: string, params: []) call. You could then have a storage abstraction on top of that that allows users to store messages in different places and in different formats.

In other words, in my opinion, vue-i18n shouldn't support ICU syntax directly, but it should have very generic interfaces and hooks that could be used to integrate one of many different syntaxes with one of many different storage mechanisms.

You would then have plug-ins for each syntax and for each storage type. vue-i18n's message syntax would also be implemented as a message formatting plug-in.

If you want to for example support hierarchical keys etc., but a storage plug-in doesn't support this, it could use an alternative serialization, like joining the keys with a period: parent.child.key.

In order for Vue.js to support i18n with ICU-like message format support, you will need to create a combination of formatjs and @vue/reactivity.

I might have to look into writing my own library, but I was hoping to avoid this. πŸ™‚

As the next roadmap for the Intlify project, the vue-i18n (intlify) message format will support compatibility with the ICU message format

The next roadmap meaning 10.x?

I completely agree with @longlho – the successor to ICU MessageFormat isn't going to be ready any time soon, but it might be possible to design interfaces/abstractions now that would allow it to be supported in the future.

Thanks anyway for the work that you do. :+1:

longlho commented 3 years ago

I thought there's a package called vue-intl that has formatjs binding? What's the difference between that and this one actually?

glen-84 commented 3 years ago

That project doesn't appear to be maintained.

kazupon commented 3 years ago

The next roadmap meaning 10.x?

I completely agree with @longlho – the successor to ICU MessageFormat isn't going to be ready any time soon, but it might be possible to design interfaces/abstractions now that would allow it to be supported in the future.

Yeah, it means is 10.x

It could not be implemented as a vue-i18n plug-in in vue-i18n@v9, but it may be possible to support it in the next major version or v9.x by abstracting the current API. I’ll put this in the next roadmap.

That project doesn't appear to be maintained.

It seems that vue-intl is not maintained.

longlho commented 3 years ago

Hmm let see if i can just take over that package