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

Interactive example for Intl.Locale #1394

Merged
merged 11 commits into from
Jul 20, 2019
13 changes: 13 additions & 0 deletions live-examples/js-examples/intl/intl-locale.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<pre>
<code id="static-js">const korean = new Intl.Locale('ko', {
script: 'Kore', region: 'KR', hourCycle: 'h24', calendar: 'gregory'
});

const japanese = new Intl.Locale('ja-Jpan-JP-u-ca-japanese-hc-h12');

console.log(korean.baseName, japanese.baseName);
// expected output: "ko-Kore-KR" "ja-Jpan-JP"

console.log(korean.hourCycle, japanese.hourCycle);
// expected output: "h24" "h12"</code>
</pre>
8 changes: 7 additions & 1 deletion live-examples/js-examples/intl/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
"title": "JavaScript Demo: Intl.ListFormat",
"type": "js"
},
"intlLocale": {
"exampleCode": "./live-examples/js-examples/intl/intl-locale.html",
"fileName": "intl-locale.html",
"title": "JavaScript Demo: Intl.Locale",
"type": "js"
},
"intlLocalePrototypeMaximize": {
"exampleCode": "./live-examples/js-examples/intl/intl-locale-prototype-maximize.html",
"fileName": "intl-locale-prototype-maximize.html",
Expand All @@ -77,7 +83,7 @@
"fileName": "intl-locale-prototype-tostring.html",
"title": "JavaScript Demo: Intl.Locale.prototype.toString()",
"type": "js"
},
},
"intlNumberFormatPrototypeFormat": {
"exampleCode": "./live-examples/js-examples/intl/intl-numberformat-prototype-format.html",
"fileName": "intl-numberformat-prototype-format.html",
Expand Down