omi-i18n
你可以通过 omi-i18n
开速开发国际化的 Omi 项目:
import { tag, WeElement } from "omi";
import { t } from "omi-i18n";
const catalog = {
welcome: "Welcome to {{name}} using omi-i18n"
};
@tag("my-app")
class MyApp extends WeElement {
render(props, data) {
return (
<i18n-provider locale="en" catalog={catalog}>
<p slot="loading">
<spinner-element />
</p>
<h1 class="app-title">{t("welcome", { name: data.name })}</h1>
</i18n-provider>
);
}
}