Published
Edited
Jul 12, 2022
7 stars
Insert cell
Insert cell
Insert cell
## ${i.__('Sample text')}

${i.__('Welcome')}

${i.__('some.weird.id')}

- ${i._n('There is %1 apple.', "There are %1 apples.", 0)}
- ${i._n('There is %1 apple.', "There are %1 apples.", 1)}
- ${i._n('There is %1 apple.', "There are %1 apples.", 2)}
- ${i._n('There is %1 apple.', "There are %1 apples.", 10)}
Insert cell
Insert cell
i = {
const i = I18n();
i.loadJSON({ ...ne }, "messages"); // Spreading since this call mutates the object.
i.loadJSON({ ...en }, "messages");

i.setLocale(locale);

return i;
}
Insert cell
ne = ({
"": {
language: "ne",
//http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html
"plural-forms": "nplurals=2; plural=n!=1;"
},
"Sample text": "नमुना पाठ",
Welcome: "स्वागत छ",
"some.weird.id": "आशा छ तपाईको आजको दिन राम्रो छ।",

// Plural forms
"There is %1 apple.": ["त्यहाँ %1 स्याउ छ।", "त्यहाँ %1 स्याउ छन्।"]
})
Insert cell
en = ({
"": {
language: "en",
"plural-forms": "nplurals=2; plural=n!=1;"
},
"some.weird.id": "Hope you are having a great day today."

// Plural forms
// "There is %1 apple": ["There is %1 apple", "There are %1 apples"]
})
Insert cell
I18n = {
const d = await import(
"https://unpkg.com/gettext.js@1.1.1/lib/gettext.js?module"
);
return d.default;
}
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