Skip to content

Localization with Unicode CLDR and overrideable strings#2894

Merged
compulim merged 53 commits intomicrosoft:masterfrom
compulim:feat-i18n
Feb 19, 2020
Merged

Localization with Unicode CLDR and overrideable strings#2894
compulim merged 53 commits intomicrosoft:masterfrom
compulim:feat-i18n

Conversation

@compulim
Copy link
Copy Markdown
Contributor

@compulim compulim commented Feb 10, 2020

Fixes #2756.

Changelog Entry

Breaking changes

  • Localization
    • locale prop: zh-YUE has been renamed to yue to conform with Unicode standard. zh-YUE will continue to work with warnings
    • Most strings are being retranslated by Microsoft localization team, except English (US), Egyptian Arabic, and Chinese Yue
      • If the new strings are undesirable, please use the overideLocalizedStrings prop to override
      • String IDs are being refreshed and use a standard format
    • useLocalize and useLocalizeDate is being deprecated. Please use useLocalizer and useLocalizerForDate instead

Added

Description

Please see docs/LOCALIZATION.md for details.

Specific Changes

I am considering renaming useLocalizerForBytes into useByteFormatter, useDateFormatter, useRelativeTimeFormatter instead.

  • Added new hooks useLocalizer, useLocalizerForBytes, useLocalizerForDate, and useLocalizerForRelativeTime
    • The newer useLocalizer will help reduce code and slightly improve performance
  • Updated useLanguage hook to support outputting oral language, which can be different from written (UI) language
  • Deprecating useLocalize and useLocalizeDate
  • Move all components to use the new hooks
  • Migrated all strings from .js into .json, before localization team has their strings ready
  • Use globalize for I18n on date, time, and unit
  • Pre-compile cldr-data into PrecompiledGlobalize.js (~140 KB for 44 languages)
  • Bump Babel to 7.8 to support copying JSON files into /lib/ folder
  • Added overrideableLocalizedStrings prop to allow developers to override our strings
  • Moved inline render Markdown logic from <SendFailedRetry> to <InlineMarkdown>

To-do

  • Run createPrecompiledGlobalize.js during npm run build
  • Update Localize.js to use latest JSON files
  • Remove *.js files
  • Bump Babel to 7.8 on all packages
  • Plural rules for toaster
  • Move "Send failed. Retry." to use <InlineMarkdown>

  • Testing Added

@compulim compulim marked this pull request as ready for review February 13, 2020 10:03
@compulim compulim changed the title [DRAFT] Localization with Unicode CLDR and overrideable strings Localization with Unicode CLDR and overrideable strings Feb 13, 2020
@compulim compulim force-pushed the feat-i18n branch 2 times, most recently from d820074 to 33ea5f5 Compare February 14, 2020 12:43
@corinagum
Copy link
Copy Markdown
Contributor

Playground updates?

Comment thread docs/LOCALIZATION.md
Comment thread packages/component/src/Localization/Localize.js Outdated
Comment thread packages/component/src/Localization/ar-SA.json Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread docs/HOOKS.md Outdated
Comment thread docs/HOOKS.md Outdated
Comment thread docs/LOCALIZATION.md Outdated
Comment thread docs/LOCALIZATION.md Outdated
Comment thread docs/LOCALIZATION.md Outdated
Comment thread docs/LOCALIZATION.md
Comment thread packages/component/src/hooks/index.js Outdated
Comment thread docs/HOOKS.md Outdated
Comment thread docs/HOOKS.md Outdated
Comment thread docs/HOOKS.md Outdated
@compulim compulim merged commit 6474886 into microsoft:master Feb 19, 2020
@compulim compulim deleted the feat-i18n branch February 19, 2020 21:36
@compulim compulim mentioned this pull request Mar 5, 2020
40 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IC3] Localization

2 participants