Mini Apps

Language and i18n

Read the Nimiq Pay host language and connect it to Nuxt i18n.

Use the language helpers when Nimiq Pay controls the preferred language and your app needs to align copy, number formatting, or Nuxt i18n with the host.

Do not use the host language as an authorization or region signal. It is a display preference.

Read the host language first

getNimiqPayLanguage() reads window.nimiqPay.language and normalizes it to a lowercase base language. pt-BR becomes pt.

app/language.ts
import {
  getNimiqPayLanguage,
  resolveNimiqPayPreferredLanguage,
} from '@onmax/nimiq-mini-app-kit'

export function readLanguage() {
  return {
    hostLanguage: getNimiqPayLanguage(),
    preferredLanguage: resolveNimiqPayPreferredLanguage(),
  }
}

Expected examples:

app/language.examples.ts
import { resolveNimiqPayPreferredLanguage } from '@onmax/nimiq-mini-app-kit'

resolveNimiqPayPreferredLanguage({
  nimiqPay: { language: ' DE ' },
}) // 'de'

resolveNimiqPayPreferredLanguage({
  window: { nimiqPay: { language: 'pt-BR' } },
}) // 'pt'

resolveNimiqPayPreferredLanguage({
  navigator: { language: 'fr-FR' },
}) // 'fr'

Use an explicit message table

Use resolveNimiqPayPreferredLanguage() when you have a small in-app dictionary and want browser and English fallbacks.

app/copy.ts
import { resolveNimiqPayPreferredLanguage } from '@onmax/nimiq-mini-app-kit'

const messages = {
  de: { pay: 'Bezahlen' },
  en: { pay: 'Pay' },
  es: { pay: 'Pagar' },
  fr: { pay: 'Payer' },
}

type SupportedLanguage = keyof typeof messages

function isSupportedLanguage(value: string): value is SupportedLanguage {
  return value in messages
}

export function getCheckoutCopy() {
  const language = resolveNimiqPayPreferredLanguage()
  const supported = isSupportedLanguage(language) ? language : 'en'

  return messages[supported]
}

Expected behavior:

  • Host language wins when present.
  • Browser language is used when the host language is missing.
  • English is used when neither value maps to a supported message table entry.

Let the Nuxt module bridge i18n

Use the built-in bridge when the app already uses @nuxtjs/i18n. The bridge only selects locales already configured in Nuxt i18n.

nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    '@nuxtjs/i18n',
    '@onmax/nimiq-mini-app-kit/nuxt',
  ],
  i18n: {
    locales: [
      { code: 'en', language: 'en-US' },
      { code: 'de', language: 'de-DE' },
      { code: 'es', language: 'es-ES' },
    ],
    defaultLocale: 'en',
  },
})

Expected behavior:

  • If Nimiq Pay publishes window.nimiqPay.language = 'de', Nuxt i18n starts on de.
  • If Nimiq Pay publishes an unsupported language, Nuxt i18n keeps its own fallback behavior.

By default, the bridge does not write the Nuxt i18n locale cookie.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n', '@onmax/nimiq-mini-app-kit/nuxt'],
  nimiqMiniAppSimulator: {
    i18n: {
      useCookie: true,
    },
  },
})

Use useCookie: true when a user who later opens the app outside Nimiq Pay should keep the same locale.

Do not use useCookie: true when every launch should follow the current host language.

Disable the bridge

Use i18n: false when the app owns locale selection and should ignore the host-selected language.

nuxt.config.ts
export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n', '@onmax/nimiq-mini-app-kit/nuxt'],
  nimiqMiniAppSimulator: {
    i18n: false,
  },
})
Copyright © 2026