indico / indico/indico

Skeleton-based formats in Chinese have duplicated 'month' glyph

Open
#5,153 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
2.1k
Forks
551
Avg merge
2d 9h
Merged PRs (30d)
21

Description

This happens because we extend the width of the fields in `_adjust_skeleton` to match the originally-requested width.

- we look up a skeleton for `MMMMyyyy`; in case of chinese that's `yMMMM`
- the format string for this skeleton in chinese is 'y年M月'
- `y` and `M` expand to just the year/month without any symbols, so using that skeleton as-is is fine.
- however, we extend the width based on what we requested which results in `yyyy年MMMM月`
- but `MMMM` expands to `十一月` (for november) so now combined with the skeleton, the `月` at the end gets duplicated

I'm not sure if this is something we can fix on our side at all (without adding an ugly hack that adds a special case for the chinese locale).

If I understand https://unicode-org.github.io/cldr/ldml/tr35-dates.html#Matching_Skeletons correctly, this is actually the expected behavior and the fix would be for the unicode data to include more appropriate patterns for chinese?

> Once a skeleton match is found, the corresponding pattern is used, but with adjustments. Consider the following dateFormatItem: `d MMM y`
> If this is the best match for `yMMMMd`, pattern is automatically expanded to produce the pattern `"d MMMM y"` in response to the request.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `_adjust_skeleton` logic described in the issue and reproduce the `MMMMyyyy` case for the Chinese locale. Compare the expanded pattern with the relevant CLDR skeleton-matching guidance, then determine whether the fix belongs in the adjustment logic or Unicode locale data. Done means the duplicated `月` glyph no longer appears without regressing skeleton expansion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
localization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.