omi-i18n

你可以通过 omi-i18n 开速开发国际化的 Omi 项目:

  1. import { tag, WeElement } from "omi";
  2. import { t } from "omi-i18n";
  3. const catalog = {
  4. welcome: "Welcome to {{name}} using omi-i18n"
  5. };
  6. @tag("my-app")
  7. class MyApp extends WeElement {
  8. render(props, data) {
  9. return (
  10. <i18n-provider locale="en" catalog={catalog}>
  11. <p slot="loading">
  12. <spinner-element />
  13. </p>
  14. <h1 class="app-title">{t("welcome", { name: data.name })}</h1>
  15. </i18n-provider>
  16. );
  17. }
  18. }