opral / inlang-sdk

0 stars 0 forks source link

Consistent use of either `languageTag` or `locale` #94

Closed NilsJacobsen closed 3 months ago

NilsJacobsen commented 5 months ago

We use languageTag in the settings and I thought it is the standard across the sdk.
No I see locale. Was this added on purpose? What should I use in the component.

I think we should agree on one.

jldec commented 5 months ago

The new MessageBundle type identifes the locale of a message using a locale property with a LanguageTag type.

This is consistent with the usage of "locale" in the ICU messageformat repos. e.g. https://github.com/search?q=repo%3Amessageformat%2Fmessageformat locale

This also matches the usage of "locale" in JavaScript https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/language

I don't really see a problem with continuing to use the LanguageTagtype as described in https://www.ietf.org/rfc/bcp/bcp47.txt . We pulled in this type from the @inlang/language-tag package in PR # 2700 because we prefer not use separately maintained packages where possible.

While I agree that it would be nice to use the same locale property everywhere, modifying the project settings format was not in scope at this time.


cc: @martin.lysk1 @loris.sigrist @samuel.stroschein
Please chime in if you had a different intent in PR #2655 or disagree

samuelstroschein commented 5 months ago

if we switch to "locale", then language tag as property name should be deprecated everywhere and replaced by "locale" to avoid confusion, including in the settings.json