Skip to content

Add Support for es-419 Locale #3362

Open
@alebak

Description

Describe the bug
When a browser is configured with the locale es-419 (Spanish for Latin America and the Caribbean), Vendure fails to load the /admin interface and displays a blank page with the following error:

Error: The defaultLocale "419" must be one of the availableLocales

This happens because es-419 is not included in the default list of availableLocales.

To Reproduce
Steps to reproduce the behavior:

  1. Configure your browser's language to es-419.
  2. Perform a fresh installation of Vendure.
  3. Start the Vendure server and navigate to the /admin interface.
  4. Observe the error: Error: The defaultLocale "419" must be one of the availableLocales.

Image

Expected behavior
Vendure should recognize es-419 as a valid locale and either:

  1. Automatically map it to es (generic Spanish), or
  2. Include es-419 in the default list of availableLocales.

This would ensure that users with es-419 configurations can access the admin interface without encountering errors.

Environment (please complete the following information):

  • @vendure/core version: 3.1.2
  • Nodejs version: 22
  • Database (mysql/postgres etc): postgres

Additional context
The es-419 locale is part of the IETF BCP 47 standard and represents Spanish as spoken in Latin America and the Caribbean. Supporting this locale would improve accessibility for users in regions where this configuration is common.

A temporary workaround is to manually add es to the availableLocales array in the Vendure configuration file (vendure-config.ts):

AdminUiPlugin.init({
  route: "admin",
  port: serverPort + 2,
  adminUiConfig: {
    defaultLocale: "es",
    availableLocales: ["es", "en"],
  },
}),

However, this should not be required for a smooth out-of-the-box experience. Adding es-419 to the default list of locales would resolve this issue.

Feature Suggestion: Full Support for IETF BCP 47 Standard

While addressing the immediate issue with es-419, it would be beneficial to consider implementing full support for the IETF BCP 47 standard. This standard defines language tags that are widely used across browsers, operating systems, and applications to identify languages and regions.

Why IETF BCP 47 Support is Important:

  1. Broader Compatibility: Many users configure their browsers with region-specific locales like es-419, fr-155 (French for Western Europe), or ar-001 (Modern Standard Arabic for global use). Supporting these locales ensures Vendure works seamlessly for a wider audience.
  2. Future-Proofing: By adhering to IETF BCP 47, Vendure would align with international best practices for localization and internationalization.
  3. Improved User Experience: Users with less common locales (e.g., numeric region codes) would no longer encounter errors or need manual configuration.

Suggested Implementation:

  1. Default Locales: Expand the default list of availableLocales to include commonly used numeric region codes like es-419, fr-155, and ar-001.
  2. Fallback Mechanism: Implement a fallback mechanism to map unsupported locales to their generic equivalents (e.g., es-419es, fr-155fr).
  3. Customizable Configuration: Allow developers to easily extend the list of supported locales via configuration files.

This enhancement would make Vendure more robust, accessible, and aligned with modern web standards.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions