Skip to content

Fix error messages in display names - #186

Merged
danrademacher merged 1 commit into
stagingfrom
1ec5-display-name-missing-translation-652
Dec 13, 2023
Merged

danrademacher merged 1 commit into
stagingfrom
1ec5-display-name-missing-translation-652

Conversation

@1ec5

@1ec5 1ec5 commented Dec 12, 2023

Copy link
Copy Markdown
Member

Temporarily replaced the localizable format string for a dated display name with a hard-coded format string. Replaced the format string for a data range with more robust usage of Intl.DateTimeFormatter.

Fixes OpenHistoricalMap/issues#652.

@1ec5 1ec5 added the bug label Dec 12, 2023
@1ec5 1ec5 self-assigned this Dec 12, 2023
Comment thread test/spec/util/util.js
expect(iD.utilDisplayName({tags: {name: 'ජය ශ්‍රී මහා බෝධිය', 'name:en': 'Jaya Sri Maha Bodhi', start_date: '-287'}})).to.eql('Jaya Sri Maha Bodhi [288 BC–]');
expect(iD.utilDisplayName({tags: {name: 'Son of the Tree That Owns Itself', start_date: '1946-12-04'}})).to.eql('Son of the Tree That Owns Itself [1946–]');
expect(iD.utilDisplayName({tags: {name: 'Great Elm', end_date: '1876-02-15'}})).to.eql('Great Elm [–1876]');
expect(iD.utilDisplayName({tags: {name: 'Arbre du Ténéré', 'name:en': 'Tree of Ténéré', start_date: '1673', end_date: '1973'}})).to.eql('Tree of Ténéré [1673 – 1973]');

@1ec5 1ec5 Dec 12, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The en dash is surrounded by thin spaces, which barely show up in the browser when a variable-width font is applied. It does make the punctuation look a bit nicer when you squint at it though.

Temporarily replaced the localizable format string for a dated display name with a hard-coded format string. Replaced the format string for a data range with more robust usage of Intl.DateTimeFormatter.
@1ec5
1ec5 force-pushed the 1ec5-display-name-missing-translation-652 branch from 4c7bccc to 6f3d1e6 Compare December 12, 2023 21:26
@1ec5
1ec5 requested a review from danrademacher December 12, 2023 21:26
@danrademacher

Copy link
Copy Markdown

Testing locally with Chinese as my locale, I see this is working like this
image

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All labels replaced by error messages in non-English iD locale

2 participants