@i18n-micro/types

TypeScript definitions for the Nuxt I18n Micro ecosystem.
297,836 251
Install
npm install @i18n-micro/types
Latest Version:1.2.18
License:MIT
Last Updated:Oct 15, 2026
Links: GitHub  ·  npm
Maintainer: s00d

@i18n-micro/types

@i18n-micro/types provides TypeScript type definitions and interfaces for the nuxt-i18n-micro ecosystem. This package is designed to enhance type safety and developer experience when working with translations, locales, and routing in a Nuxt.js application. It includes types for locales, routing strategies, translation parameters, and more.

Installation

You can install @i18n-micro/types using npm or yarn:

npm install @i18n-micro/types

or

yarn add @i18n-micro/types

Usage

This package provides TypeScript types and interfaces for working with nuxt-i18n-micro. It is primarily used to ensure type safety when defining locales, routing strategies, and translation parameters.

Example

Here’s an example of how you might use the types provided by this package:

import { Locale, Strategies, ModuleOptions, I18nRouteParams } from '@i18n-micro/types'

// Define locales
const locales: Locale[] = [
  {
    code: 'en',
    iso: 'en-US',
    dir: 'ltr',
    displayName: 'English',
    baseUrl: 'https://example.com/en',
  },
  {
    code: 'de',
    iso: 'de-DE',
    dir: 'ltr',
    displayName: 'German',
    baseUrl: 'https://example.com/de',
  },
]

// Define routing strategy
const strategy: Strategies = 'prefix_except_default'

// Define module options
const options: ModuleOptions = {
  locales,
  strategy,
  defaultLocale: 'en',
  strategy: 'prefix',
}

// Define route parameters
const routeParams: I18nRouteParams = {
  en: { page: 'home' },
  de: { page: 'startseite' },
}

API Reference

Types and Interfaces

Locale

Represents a locale configuration.

LocaleCode

Represents a locale code (e.g., 'en', 'de').

Strategies

Represents the available routing strategies.

export type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default'
ModuleOptions

Represents the configuration options for the nuxt-i18n-micro module.

ModuleOptionsExtend

Extends ModuleOptions with additional properties.

I18nRouteParams

Represents route parameters for different locales.

Params

Represents a key-value pair of parameters for interpolation.

PluralFunc

Represents a function for handling pluralization in translations.

GlobalLocaleRoutes

Represents global route configurations for different locales.

Translations

Represents a key-value pair of translations.

Page-level SEO head (useI18nHead)

Types for per-page i18n SEO overrides: I18nHeadInput, I18nHeadLink, I18nHeadMeta, and I18nHeadDisableGroup. Use them in page helpers or when calling useI18nHead from @i18n-micro/types for typed meta, link, replace, and disable options.

import type { I18nHeadInput } from '@i18n-micro/types'

export function buildArticleHead(article: Article): I18nHeadInput {
  return {
    meta: [{ property: 'og:title', content: article.title }],
    replace: { canonical: article.canonicalUrl, ogUrl: article.canonicalUrl },
  }
}
Translation

Represents a translation value, which can be a string, number, boolean, nested translations, or null.

PluralTranslations

Represents translations for singular and plural forms.

Contributing

If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for more details.


For more information, visit the GitHub repository.

Author

Related Packages

@vintl/nuxt

Nuxt Module for VIntl integration

9,922 2
@brc-dd/nuxt-i18n

Minimal module for i18n with locale auto-imports & localized routing

898 12
@nuxtjs/i18n

Internationalization for Nuxt

23,877,608 2,085
@nuxtjs/i18n-edge

Internationalization for Nuxt

121,288 2,085
@i18n-micro/hmr

Translation HMR utilities for Nuxt I18n Micro (granular subpath imports).

51,795 251

Version History

Version Released License
1.2.18 MIT
1.2.17 MIT
1.2.16 MIT
1.2.15 MIT
1.2.14 MIT