microsoft / microsoft/BotFramework-WebChat

useLocalizeDate failed because the language is not in CLDR

Open
#3,039 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

backlog bug front-burner needs-scheduling p1
Dominant language
HTML
Stars
1.8k
Forks
1.6k
Avg merge
22h 58m
Merged PRs (30d)
2

Description

Screenshots

image

(It is okay to pass "en" to language. But not okay to pass "en-US".)

Version

4.8.0

Describe the bug

In useLocalizeDate.js, we are passing a language identifier of "en-US", but getLocaleString.js is expecting "en" instead (the one specified in CLDR).

If the language identifier is not found in the CLDR database, then, the dateFormatter() function will return undefined.

Steps to reproduce

  1. Run the hook useLocalizeDate

Expected behavior

It should return the date in localized format.

Instead, it throw an exception:

image

Additional context

Related to https://github.com/microsoft/BotFramework-Emulator/issues/2119.

[Bug]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with useLocalizeDate.js and getLocaleString.js, then trace how dateFormatter() handles the "en-US" language identifier. Reproduce the issue by running the useLocalizeDate hook with "en-US" and confirm the localized date is returned without an exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, internationalization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.