diff --git a/packages/gunshi/src/cli.test.ts b/packages/gunshi/src/cli.test.ts index 2a1ed3b30..566ac25d6 100644 --- a/packages/gunshi/src/cli.test.ts +++ b/packages/gunshi/src/cli.test.ts @@ -555,7 +555,7 @@ describe('auto generate usage', () => { plugins: [ i18n({ locale: 'ja-JP', - resources: { 'ja-JP': jsJPResource } + builtinResources: { 'ja-JP': jsJPResource } }) ] }) diff --git a/packages/plugin-i18n/README.md b/packages/plugin-i18n/README.md index db3ffe651..07a2d9f53 100644 --- a/packages/plugin-i18n/README.md +++ b/packages/plugin-i18n/README.md @@ -79,7 +79,7 @@ await cli(process.argv.slice(2), greetCommand, { - Default: `'en-US'` - Description: The locale to use for translations. Can be a BCP 47 language tag string or an `Intl.Locale` object. -### `resources` +### `builtinResources` - Type: `Record>` - Default: `{}` @@ -120,7 +120,7 @@ await cli(args, command, { globals(), // Adds --help and --version options i18n({ locale: 'ja-JP', - resources: { + builtinResources: { 'ja-JP': jsJPResource // Set from with providing gunshi built-in resources } }) diff --git a/packages/plugin-i18n/src/index.test.ts b/packages/plugin-i18n/src/index.test.ts index c398ba0dd..40ef946b4 100644 --- a/packages/plugin-i18n/src/index.test.ts +++ b/packages/plugin-i18n/src/index.test.ts @@ -69,7 +69,7 @@ describe('extension: translate', () => { const jaJPResource = await import('@gunshi/resources/ja-JP', { with: { type: 'json' } }).then( m => m.default || m ) - const plugin = i18n({ locale: 'ja-JP', resources: { 'ja-JP': jaJPResource } }) + const plugin = i18n({ locale: 'ja-JP', builtinResources: { 'ja-JP': jaJPResource } }) const ctx = await createMockCommandContext() const extension = await plugin.extension.factory(ctx, {} as Command) diff --git a/packages/plugin-i18n/src/index.ts b/packages/plugin-i18n/src/index.ts index 693532c66..14ff68fef 100644 --- a/packages/plugin-i18n/src/index.ts +++ b/packages/plugin-i18n/src/index.ts @@ -83,8 +83,8 @@ export default function i18n( const locale = toLocale(options.locale) const localeStr = toLocaleString(locale) - const resources = - options.resources || + const builtinResources = + options.builtinResources || (Object.create(null) as Record>) // create translation adapter @@ -150,7 +150,7 @@ export default function i18n( setResource(DEFAULT_LOCALE, DefaultResource as Record) // install built-in locale resources - for (const [locale, resource] of Object.entries(resources)) { + for (const [locale, resource] of Object.entries(builtinResources)) { setResource(locale, resource) } diff --git a/packages/plugin-i18n/src/types.ts b/packages/plugin-i18n/src/types.ts index 6e15abb52..939b7c809 100644 --- a/packages/plugin-i18n/src/types.ts +++ b/packages/plugin-i18n/src/types.ts @@ -90,7 +90,7 @@ export interface I18nPluginOptions { /** * Built-in localizable resources */ - resources?: Record> + builtinResources?: Record> } /**