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

Add "fallback" option #28

Merged
merged 10 commits into from May 18, 2019

Conversation

Projects
None yet
6 participants
@FrankYFTang
Copy link
Collaborator

commented May 11, 2019

Address #23

@ljharb

ljharb approved these changes May 11, 2019

Copy link
Member

left a comment

Seems reasonable; altho it might be useful to think about what the option would look like if in the future support was added for providing a custom fallback callback.

spec.emu Outdated
@@ -316,6 +327,7 @@ contributors: Google, Ecma International
<li>[[Locale]] is a String value with the language tag of the locale whose localization is used for formatting.</li>
<li>[[Style]] is one of the String values `"narrow"`, `"short"`, or `"long"`, identifying the display names style used.</li>
<li>[[Type]] is one of the String values `"language"`, `"region"`, `"script"`, `"currency"`, `"dateField"`, or `"dateSymbol"`, identifying the type of the display names requested.</li>
<li>[[Substitute]] is one of the String values `"fallback"`, or `"none"`, identifying what to return while the system does not have the requested display name.</li>

This comment has been minimized.

Copy link
@sffc

sffc May 13, 2019

Collaborator

Have you done research on precedent in the web platform on possible naming for this sort of feature? The first thing that comes to mind is multiple load paths for modules.

The words "substitute" and "fallback" seem too redundant to me, but that might be my bias as an ICU developer. Maybe something more specific like substitute: "code" or substitute: "use-input", or use one of those keys with fallback as the key?

This comment has been minimized.

Copy link
@FrankYFTang

FrankYFTang May 14, 2019

Author Collaborator

how about substitute: 'fallbackToCode' , 'none'

This comment has been minimized.

Copy link
@sffc

sffc May 14, 2019

Collaborator

"fallback" is a noun. When used as a verb, there are two words. Also, as mentioned in #29, we use kebab case for strings. So, the option you proposed would be, substitute: "fall-back-to-code". That could work, but it is a bit wordy.

This comment has been minimized.

Copy link
@gibson042

gibson042 May 14, 2019

I somehow completely missed 49f62f0 and have been operating from the perspective of Intl.DisplayNames.prototype.of( codes ). With scalar input, is there even sufficient value in making this configurable as opposed to always returning undefined? I would expect fallback to be implemented by user code like codes.map(code => displayNameFormatter.of(code) || code).

But if we do want to keep it and are bikeshedding, I'd propose fallback: "code" and fallback: "none".

This comment has been minimized.

Copy link
@sffc

sffc May 14, 2019

Collaborator

With scalar input, is there even sufficient value in making this configurable as opposed to always returning undefined?

My positions recorded in the notes still stand in favor of the option.

I'd propose fallback: "code" and fallback: "none".

LGTM

@FrankYFTang FrankYFTang changed the title Add substitute option Add "fallback" option May 15, 2019

@FrankYFTang

This comment has been minimized.

Copy link
Collaborator Author

commented May 15, 2019

PTAL I change to

fallback: "code" and fallback: "none".

@FrankYFTang FrankYFTang requested review from sffc, gibson042 and ljharb May 16, 2019

@FrankYFTang

This comment has been minimized.

Copy link
Collaborator Author

commented May 16, 2019

Everyone PTAL by end of Friday May 17 2019. Thanks

@ljharb

ljharb approved these changes May 16, 2019

Show resolved Hide resolved spec.emu Outdated
Show resolved Hide resolved spec.emu Outdated
@littledan

This comment has been minimized.

Copy link
Member

commented May 17, 2019

This seems to match our conclusion in the ECMA-402 meeting.

FrankYFTang added some commits May 18, 2019

address feedback from ljharb
1. _fallback_ -> _displayNames_.[[Fallback]]
2. while -> when

@FrankYFTang FrankYFTang merged commit 618f328 into tc39:master May 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.