ice/packages/plugin-i18n
ClarkXia 2616c68325
chore: update versions (#6906)
2024-06-26 10:28:56 +08:00
..
src feat: i18n plugin (#6149) 2023-04-24 10:18:53 +08:00
CHANGELOG.md chore: update versions (#6884) 2024-05-30 10:08:41 +08:00
README.md feat: i18n plugin (#6149) 2023-04-24 10:18:53 +08:00
build.config.mts fix: source map url in prod files but the sourceMap files not published (#6511) 2023-09-06 10:09:59 +08:00
package.json chore: update versions (#6906) 2024-06-26 10:28:56 +08:00
runtime.d.ts feat: i18n plugin (#6149) 2023-04-24 10:18:53 +08:00
tsconfig.json feat: i18n plugin (#6149) 2023-04-24 10:18:53 +08:00
types.d.ts feat: i18n plugin (#6149) 2023-04-24 10:18:53 +08:00

README.md

@ice/plugin-i18n

组件功能描述

Install

$ npm i @ice/plugin-i18n --save-dev

Usage

import { defineConfig } from '@ice/app';
import i18n from '@ice/plugin-i18n';

export default defineConfig({
  plugins: [
    i18n({
      locales: ['zh-CN', 'en-US'],
      defaultLocale: 'zh-CN',
    }),
  ],
});

Options

locales

  • type: string[]

The locales you want to support in your app. This option is required.

defaultLocale

  • type: string

The default locale you want to be used when visiting a non-locale prefixed path. This option is required.

autoRedirect

  • type: boolean
  • default: true

Redirect to the preferred locale automatically. This option should be used with the middleware. If you deploy your application in production, you should read the example for more detail.