Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining multi channels and multi locales not supported #1950

Open
cartamundi-tvae opened this issue Feb 3, 2025 · 0 comments
Open

Combining multi channels and multi locales not supported #1950

cartamundi-tvae opened this issue Feb 3, 2025 · 0 comments

Comments

@cartamundi-tvae
Copy link

localeLanguageRegionMap in core/i18n/routing.ts can be populated with the different locales you want to support. This list however is then filtered by only the locales supported by the default channel configured in your .env.local file. And does not take into account any other channels you define in your core/channels.config.ts file.

const localeNodes = buildConfig.get('locales');

export const locales = localeNodes.map((locale) => locale.code);

export const localeLanguageRegionMap: LocaleEntry[] = [
  { id: 'en', language: 'English', region: 'United States', flag: '🇺🇸' },
  { id: 'nl', language: 'Nederlands', region: 'Nederland', flag: '🇳🇱' },
].filter(({ id }) => locales.includes(id));
// next.config.ts
await writeLocaleToBuildConfig();

async function writeLocaleToBuildConfig() {
  const { data } = await client.fetch({ document: LocaleQuery });

  await writeBuildConfig({ locales: data.site.settings?.locales });
}

Ideally this would also support a setup with multiple storefronts, each having it's own set of locales:

  1. North America (default) www.site.com/na
    • English
    • Spanish
  2. Europe www.site.com/eu
    • English
    • Dutch
    • French
    • German

These should be combined to work as follows:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant