eversport / intl-codegen

generate code and type definitions from translations
MIT License
15 stars 1 forks source link

Pass active language in context #21

Closed treylon closed 5 years ago

treylon commented 5 years ago

It would help a lot to expose the current language in the context, especially in SSR rendered apps.

Swatinem commented 5 years ago

Intl.locale already exists

Swatinem commented 5 years ago

BTW, I am planning to introduce also a breaking change for this in v2. Currently all the number/date formatting is based on the language you author the translations in. So currently Intl.locale is whatever you generate with the codegen. In the future, I would like to make locale whatever the user requests. So if the navigator.language is de-at, you would get currency formatting for austrian german that is different for swiss german, even if you only have a single translation bundle for the german language.