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

Additional Region Support for select locales #7413

Open
rgeraghty opened this issue Nov 20, 2024 · 2 comments
Open

Additional Region Support for select locales #7413

rgeraghty opened this issue Nov 20, 2024 · 2 comments
Assignees

Comments

@rgeraghty
Copy link
Collaborator

rgeraghty commented Nov 20, 2024

Provide a general summary of the feature here

We would like to support some additional locales for region support, in same way as exists for French (Canada)

Meaning....

  • Only added regional support, no new translations required

Example...

  • French Canadian
    • In case of French (Canada) we display translations using fr-FR (French France), but use region of Canada.

New locales requested...

  • es-419 (Spanish, Latin America)
  • es-MS (Spanish, Mexico)
  • en-AU (English, Australian)
  • en-IL (English, Israel)

🤔 Expected Behavior?

  • es-419: displays es-ES translations, but uses es-419 region
  • es-MX: displays es-MX translations, but uses es-MX region
  • en-AU: display en-US translations, but uses en-AU region
  • en-IL: display en-US translations, but uses en-IL region

However, if intl string files added for any of the above, at later stage, then use matching strings files (eg: en-AU string files + region). Looking at current code seems already supported, just need the locales list updated for above,

😯 Current Behavior

These will all revert to en-US only

💁 Possible Solution

From looking at the code, looks like it might be just updating language tables:
https://github.com/adobe/react-spectrum/blob/main/.chromatic-fc/constants.js
https://github.com/adobe/react-spectrum/blob/main/packages/dev/docs/pages/react-aria/home/I18n.tsx
https://github.com/adobe/react-spectrum/blob/main/packages/%40internationalized/message/src/MessageDictionary.ts
https://github.com/adobe/react-spectrum/blob/main/packages/%40internationalized/string/src/LocalizedStringDictionary.ts

and some related files like storybook and tests:
https://github.com/adobe/react-spectrum/blob/main/.storybook/constants.js
https://github.com/adobe/react-spectrum/blob/main/.storybook-s2/constants.js
https://github.com/adobe/react-spectrum/blob/main/packages/%40internationalized/date/tests/DateFormatter.test.js
https://github.com/adobe/react-spectrum/blob/main/packages/%40internationalized/date/tests/queries.test.js

MessageDictinary looks to already support this functionality, with just adding language codes to support. es-419 might need extra handling as not xx-XX format.

🔦 Context

Match other Adobe areas (pls contact rgeraght, lreis any question)

💻 Examples

No response

🧢 Your Company/Team

Adobe

🕷 Tracking Issue

No response

@dannify
Copy link
Member

dannify commented Nov 20, 2024

Should en-AU: display en-GB translations, but use en-AU region?? @rgeraghty

@rgeraghty
Copy link
Collaborator Author

rgeraghty commented Nov 21, 2024

@dannify en-AU would fall back to en-US strings (as no en-AU strings present, like en-GB falls back to en-US) but use the en-AU region (https://github.com/adobe/react-spectrum/blob/main/packages/%40internationalized/message/src/MessageDictionary.ts#L59)

We have option at any time to add strings for en-AU, en-GB, fr-CA, es-MX etc.... if feel its needed, but not required for this this issue request, which is just add additional locales to current lang supported list, to get the region support.

I updated expected behaviour (just now) in issue description to add note for this,

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

No branches or pull requests

3 participants