laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

[Proposal] Use intl extension for translations #160

Closed Skysplit closed 6 years ago

Skysplit commented 8 years ago

It would be nice to have intl MessageFormatter implemented in current translation module.

Currently it is impossible to properly format plural rules in many languages, as this languages' rules are not just ranges, but often require modulo operations etc.

Examples: rules for Polish, Russian, Arabic and many more

Examples of usage (sorry for posting own package here):
https://github.com/Skysplit/laravel5-intl-translation#usage-examples

Downside: it requires installing php-intl extenstion (though most of the time if someone meets php 5.6 requirements, can also meet intl extension requirement)

Edit: Also, due translation module being tightly coupled to validation module, issue #156 is related

peterquentin commented 8 years ago

Could we not make intl optional but recommended and fallback on current routine?

Skysplit commented 8 years ago

I could not find any polyfill for MessageFormatter on packagist, so it'd be required to create one. However I think it is very complex task to do polyfill like this as there are really lot of rules that must be parsed, like: spellout, ordinal, duration and many more