Public
Edited
Oct 2, 2023
Insert cell
Insert cell
Insert cell
navigator.language
Insert cell
Insert cell
(() => {
const date = new Date();

return `
en-US: ${new Intl.DateTimeFormat('en-US').format(date)}
en-CA: ${new Intl.DateTimeFormat('en-CA').format(date)}
en-GB (full): ${new Intl.DateTimeFormat('en-GB', {dateStyle: 'full', timeStyle: 'long'}).format(date)}
`;
})()
Insert cell
Insert cell
(() => {
const num = 1579.01

return `
en-US: ${new Intl.NumberFormat('en-US').format(num)}
fr: ${new Intl.NumberFormat('fr').format(num)}
de: ${new Intl.NumberFormat('de').format(num)}
`;
})()
Insert cell
Insert cell
(() => {
const vehicles = ['Motorcycle', 'Bus', 'Car'];


return `
en: ${new Intl.ListFormat('en').format(vehicles)}
de: ${new Intl.ListFormat('de').format(vehicles)}
`;
})()
Insert cell
Insert cell
(() => {
const pr = new Intl.PluralRules("en");
const apr = new Intl.PluralRules("ar");

return `
en 0: ${pr.select(0)}
en 1: ${pr.select(1)}
en 2: ${pr.select(2)}
en 3: ${pr.select(3)}

ar 0: ${apr.select(0)}
ar 1: ${apr.select(1)}
ar 2: ${apr.select(2)}
ar 3: ${apr.select(3)}
ar 4: ${apr.select(4)}
`;
})()
Insert cell
Insert cell
(() => {
const pr = new Intl.PluralRules("en", {type: 'ordinal'});

return `
en 0: ${pr.select(0)}
en 1: ${pr.select(1)}
en 2: ${pr.select(2)}
en 3: ${pr.select(3)}
en 4: ${pr.select(4)}
en 11: ${pr.select(11)}
en 41: ${pr.select(41)}
en 45: ${pr.select(45)}
`;
})()
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more