Skip to content

Commit

Permalink
feat(pix-site): add runtimeConfig.public.availableLocaleCodes
Browse files Browse the repository at this point in the history
  • Loading branch information
lego-technix committed Oct 2, 2024
1 parent b12c094 commit 40fc29e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pix-site/i18n.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { generateConfig } from '../shared/i18n.config';

const reachableLocales = [
{
// The "code" property should be renamed into "name": https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/Locale
code: 'en',
iso: 'en',
file: 'en.js',
// The "name" property should be renamed into "displayName": https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/DisplayNames
name: 'English',
icon: 'globe-europe.svg',
domain: process.env.DOMAIN_ORG,
Expand Down Expand Up @@ -43,6 +45,8 @@ const reachableLocales = [
},
];

const reachableLocaleNames = reachableLocales.map(reachableLocale => reachableLocale.code);

const config = generateConfig(reachableLocales);
export default { ...config };
export { reachableLocales };
export { reachableLocales, reachableLocaleNames };
3 changes: 2 additions & 1 deletion pix-site/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getRoutesToGenerate } from './services/get-routes-to-generate';
import i18nConfig, { reachableLocales } from './i18n.config';
import i18nConfig, { reachableLocales, reachableLocaleNames } from './i18n.config';

export default async () => {
const routes = process.env.NODE_ENV !== 'test' ? await getRoutesToGenerate({ locales: i18nConfig.locales }) : [];
Expand All @@ -24,6 +24,7 @@ export default async () => {
siteDomain: process.env.SITE_DOMAIN,
formKeysToMap: process.env.FORM_KEYS_TO_MAP || null,
availableLocales: reachableLocales,
availableLocaleNames: reachableLocaleNames,
},
},
nitro: {
Expand Down

0 comments on commit 40fc29e

Please sign in to comment.