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:
- Configure your browser's language to es-419.
- Perform a fresh installation of Vendure.
- Start the Vendure server and navigate to the /admin interface.
- Observe the error: Error: The defaultLocale "419" must be one of the availableLocales.
Expected behavior
Vendure should recognize es-419
as a valid locale and either:
- Automatically map it to es (generic Spanish), or
- 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:
- Broader Compatibility: Many users configure their browsers with region-specific locales like
es-419
,fr-155
(French for Western Europe), orar-001
(Modern Standard Arabic for global use). Supporting these locales ensures Vendure works seamlessly for a wider audience. - Future-Proofing: By adhering to IETF BCP 47, Vendure would align with international best practices for localization and internationalization.
- Improved User Experience: Users with less common locales (e.g., numeric region codes) would no longer encounter errors or need manual configuration.
Suggested Implementation:
- Default Locales: Expand the default list of availableLocales to include commonly used numeric region codes like
es-419
,fr-155
, andar-001
. - Fallback Mechanism: Implement a fallback mechanism to map unsupported locales to their generic equivalents (e.g.,
es-419
→es
,fr-155
→fr
). - 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.