nuxt / nuxt/ui

Locale keys in @nuxt/ui-pro/locale should follow standard BCP-47 codes (fa not fa_ir)

Open
#4,819 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
6.9k
Forks
1.1k
Avg merge
1d 7h
Merged PRs (30d)
57

Description

Environment

Problem

Some locales in @nuxt/ui-pro/locale use non-standard keys such as:

  • fa_ir (instead of fa or fa-IR)
  • pt_br (instead of pt-BR)
  • nb_no (instead of nb-NO)
  • etc.

This causes a mismatch with most i18n setups (e.g., @nuxtjs/i18n) which follow the BCP-47 language tag standard.

For example:

  • In Nuxt i18n the locale is fa (or fa-IR).
  • In Nuxt UI Pro the locale key is fa_ir.
  • Result: developers must create extra mapping logic just to connect i18n with UI components like ULocaleSelect.

Why it matters

  • Inconsistent keys break interoperability between Nuxt UI Pro and @nuxtjs/i18n.
  • It forces developers to maintain custom bridges for every mismatch.
  • It also confuses users, because the button label may show the raw key (e.g., fa_ir) instead of the proper locale name/flag.

Expected

All locale keys in @nuxt/ui-pro/locale should follow standard BCP-47 language codes:

  • fa or fa-IR ✅ (not fa_ir ❌)
  • pt-BR ✅ (not pt_br ❌)
  • nb-NO ✅ (not nb_no ❌)

Suggestions

  1. Rename locale keys to valid BCP-47 codes.
    Example: fa_irfa, pt_brpt-BR.

  2. Keep backward compatibility by exporting aliases for old keys for a while, but mark them as deprecated.

  3. Update documentation for ULocaleSelect and locales import to clarify the codes being used.

Impact

Aligning with BCP-47 will make @nuxt/ui-pro/locale plug-and-play with @nuxtjs/i18n and other internationalization libraries, removing the need for manual bridges.

Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.3.2

Reproduction
<script setup lang="ts"> import * as locales from '@nuxt/ui-pro/locale' const model = ref('fa_ir') </script>
Description

Short description
Some locale keys in @nuxt/ui-pro/locale are not following the standard BCP-47 format. For example, Persian is exported as fa_ir while Nuxt i18n and most setups expect fa (or fa-IR). This mismatch forces developers to write custom mappings and may happen with other languages as well (pt_br, nb_no, …). Keys should be aligned with BCP-47 (fa, pt-BR, nb-NO, etc.) or at least provide aliases.

Additional context

No response

Logs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the @nuxt/ui-pro/locale exports and the ULocaleSelect usage shown in the reproduction, then compare the locale keys with the BCP-47 examples and @nuxtjs/i18n expectations. Determine the canonical keys and whether old keys need aliases, then update the related ULocaleSelect and locales documentation. Done means the affected keys interoperate without custom mappings and the documented behavior is clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, typescript
Domain
frontend, internationalization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.