LoginSignup
3
2

More than 3 years have passed since last update.

Nuxt-i18nで簡単に多言語対応!

Last updated at Posted at 2019-05-13
1 / 10

自己紹介

tanshio(@_tanshio)

フロントエンドエンジニア、ウェブデザイナー
好きなものはVue・Nuxt、TypeScript、WebGLです
いま挑戦中のものはGatsbyとGoです


多言語対応

つらい


  • どこで何が呼ばれているかわからない
  • いろいろとつらい

Nuxtだと簡単だった


Nuxti-18nで簡単に多言語対応


基本的に使うもの

  • {{ $t('文字列') }}
    • 文字列部分は変数が使える
  • <n-link :to="localePath('リンク先')">index</n-link>
    • localpathで現在の言語でのリンク
  • <nuxt-link :to="switchLocalePath('en')">en</nuxt-link>
    • switchLocalePath('言語')で言語切替

デモ


Nuxtで世界に発信しよう!


デモのURLです
https://github.com/tanshio/nuxt-ts-starter

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2