{"action":"created","issue":{"url":"https://api.github.com/repos/brawer/proposal-intl-displaynames/issues/4","repository_url":"https://api.github.com/repos/brawer/proposal-intl-displaynames","labels_url":"https://api.github.com/repos/brawer/proposal-intl-displaynames/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/brawer/proposal-intl-displaynames/issues/4/comments","events_url":"https://api.github.com/repos/brawer/proposal-intl-displaynames/issues/4/events","html_url":"https://github.com/brawer/proposal-intl-displaynames/issues/4","id":331165587,"node_id":"MDU6SXNzdWUzMzExNjU1ODc=","number":4,"title":"Function on Intl vs method on Intl.Locale","user":{"login":"littledan","id":189835,"node_id":"MDQ6VXNlcjE4OTgzNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/189835?v=4","gravatar_id":"","url":"https://api.github.com/users/littledan","html_url":"https://github.com/littledan","followers_url":"https://api.github.com/users/littledan/followers","following_url":"https://api.github.com/users/littledan/following{/other_user}","gists_url":"https://api.github.com/users/littledan/gists{/gist_id}","starred_url":"https://api.github.com/users/littledan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/littledan/subscriptions","organizations_url":"https://api.github.com/users/littledan/orgs","repos_url":"https://api.github.com/users/littledan/repos","events_url":"https://api.github.com/users/littledan/events{/privacy}","received_events_url":"https://api.github.com/users/littledan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-06-11T12:20:09Z","updated_at":"2018-07-17T13:13:24Z","closed_at":null,"author_association":"COLLABORATOR","body":"@nciric [originally suggested](https://github.com/tc39/proposal-intl-locale/issues/45) this feature as a method on `Intl.Locale`, rather than a function property `Intl`. Personally, I was originally thinking that we would eventually go with this as a method on locales. There's a third possibility, of making a display name factory, analogous to other Intl formatters. Let's discuss the pros and cons of each path here:\r\n\r\n**In favor of a Locale method**\r\n- Example\r\n```js\r\nvar t = new Intl.Locale('sr')\r\nt.languageNameOf('en')   // Енглески\r\nt.regionNameOf('GB')     // Велика Британија\r\n\r\nvar x = new Intl.Locale('sr-Latn')\r\nx.languageNameOf('en')   // Engleski\r\nx.regionNameOf('GB')     // Velika Britanija\r\n```\r\n- Pro\r\n  - Terse and ergonomic\r\n- Con\r\n  - First time we're attaching data lookup to Intl.Locale\r\n  - Doesn't support locale negotiation\r\n\r\n**In favor of an Intl function**\r\n- Example\r\n```js\r\nlet langs = getLanguageDisplayNames([\"pl\"], [\"fr\", \"de\", \"en\", \"sr-Latn-XK\"]);\r\nlangs === [\"Francuski\", \"Niemiecki\", \"Angielski\", \"Serbski\"];\r\n\r\nlet regs = getRegionDisplayNames([\"pl\"], [\"US\", \"CA\", \"MX\"]);\r\nregs === [\"Stany Zjednoczone\", \"Kanada\", \"Meksyk\"];\r\n\r\nlet locs = getLocaleDisplayNames([\"pl\"], [\"sr-RU\", \"es-MX\", \"fr-CA\", \"sr-Latn-XK\"]);\r\nlocs === [\"Serbski (Rosja)\", \"Hiszpański (Meksyk)\", \"Francuski (Kanada)\", \"Serbski (Łacińskie, Kosowo)\"];\r\n```\r\n- Pro\r\n  - Supports locale negotiation (where a method on Locale could only return undefined to indicate failure)\r\n  - Amortize costs by operating on an array\r\n- Con\r\n  - Sustainable top-level use of Intl namespace?\r\n  - Result of locale negotiation isn't exposed (as it is for \r\n\r\n**In favor of a factory object**\r\n- Example\r\n```js\r\nvar n = new Intl.DisplayName('sr')\r\nt.languageNameOf('en')   // Енглески\r\nt.regionNameOf('GB')     // Велика Британија\r\n\r\nvar x = new Intl.DisplayName('sr-Latn')\r\nx.languageNameOf('en')   // Engleski\r\nx.regionNameOf('GB')     // Velika Britanija\r\n```\r\n- Pro:\r\n  - Gives a way to query the result of locale negotiation through `resolvedOptions()`\r\n  - Consistent with all the other formatters\r\n  - Might be able to amortize certain costs (TODO: evaluate this)\r\n- Con:\r\n  - Wordy\r\n  - Creates another constructor which doesn't do much\r\n\r\nAfter writing all that out, I'm leaning slightly towards the last one, but my main intention in writing this up was so we could all think this through. Do you see any more pros or cons for particular options?"},"comment":{"url":"https://api.github.com/repos/brawer/proposal-intl-displaynames/issues/comments/405576932","html_url":"https://github.com/brawer/proposal-intl-displaynames/issues/4#issuecomment-405576932","issue_url":"https://api.github.com/repos/brawer/proposal-intl-displaynames/issues/4","id":405576932,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTU3NjkzMg==","user":{"login":"rxaviers","id":967155,"node_id":"MDQ6VXNlcjk2NzE1NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/967155?v=4","gravatar_id":"","url":"https://api.github.com/users/rxaviers","html_url":"https://github.com/rxaviers","followers_url":"https://api.github.com/users/rxaviers/followers","following_url":"https://api.github.com/users/rxaviers/following{/other_user}","gists_url":"https://api.github.com/users/rxaviers/gists{/gist_id}","starred_url":"https://api.github.com/users/rxaviers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rxaviers/subscriptions","organizations_url":"https://api.github.com/users/rxaviers/orgs","repos_url":"https://api.github.com/users/rxaviers/repos","events_url":"https://api.github.com/users/rxaviers/events{/privacy}","received_events_url":"https://api.github.com/users/rxaviers/received_events","type":"User","site_admin":false},"created_at":"2018-07-17T13:13:24Z","updated_at":"2018-07-17T13:13:24Z","author_association":"NONE","body":"Ok thanks for clarifying..."}}
{"actor":{"display_login":"rxaviers"}}