Code-for-SAKE / Sakepedia-Nuxt3

みんなでつくる日本酒オープンデータSakepediaのNuxt3版
https://sakepedia-nuxt3.web.app/
4 stars 5 forks source link

Translate Japanese #27

Open nichesuch opened 3 months ago

nichesuch commented 3 months ago

if there is Japanese, Please translate

Internationalization file

i18n.config.ts

  messages: {
    ja: {
      ...
      brewery: "酒蔵",
      details: "詳細",
      ...
    },
    en: {
      ...
      brewery: "Brewery",
      details: "Details",
      ...
    },
    ...

usage in template

before

<h1>酒蔵 詳細</h1>

after

<h1>{{ $t("brewery") }} {{ $t("details") }} </h1>

usage in script

before

const columns = [
  {
    key: "name",
    label: "名前",
    sortable: true,
  },
]

after

const { t } = useI18n()

...

const columns = [
  {
    key: "name",
    label: t("name"),
    sortable: true,
  },
]

new language

nuxt.config.ts

  i18n: {
    locales: [
      ...
      {
        code: 'new',
        name: '新しい言語'
      },
    ],
  }

i18n.config.ts

  messages: {
    ...
    new: {
      ...
    },
  }
youkey0211 commented 1 month ago

■追加■ Languageで外国語(英語)を選択。 Breweries→Addで情報を選択。 Add Breweryの指定情報が日本語のまま。 例:ふりがな、住所、都道府県(プルダウンも日本語)