Skip to content

Commit 70a219c

Browse files
committed
chore(frontend): add user-facing name for locales
1 parent c1a2352 commit 70a219c

1 file changed

Lines changed: 38 additions & 7 deletions

File tree

apps/frontend/nuxt.config.ts

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,18 @@ const siteConfig = {
2121
description: 'Monorepo with 🤖 AI initialize and localize | 🔥Hono + OpenAPI & RPC, Nuxt, Convex, SST Ion, Kinde Auth, Tanstack Query, Shadcn, UnoCSS, Spreadsheet I18n, Lingo.dev',
2222
}
2323

24-
function genFrontendLocale(code: string, languageISO: string, dir?: LocaleObject<string>['dir']): LocaleObject<string> {
24+
interface GenFrontendLocaleProps {
25+
code: string
26+
languageISO: string
27+
name?: string
28+
dir?: LocaleObject<string>['dir']
29+
}
30+
function genFrontendLocale({ code, languageISO, name, dir }: GenFrontendLocaleProps): LocaleObject<string> {
2531
return {
2632
code,
2733
language: languageISO,
2834
files: [`${code}.json`, `frontend/${code}.json`],
35+
name,
2936
dir,
3037
}
3138
}
@@ -154,12 +161,36 @@ export default defineNuxtConfig({
154161
strategy: 'no_prefix',
155162
defaultLocale: 'en',
156163
locales: [
157-
genFrontendLocale('en', 'en-US'),
158-
genFrontendLocale('es', 'es-ES'),
159-
genFrontendLocale('fr', 'fr-FR'),
160-
genFrontendLocale('ru', 'ru-RU'),
161-
genFrontendLocale('vi', 'vi-VN'),
162-
genFrontendLocale('zh-CN', 'zh-CN'),
164+
genFrontendLocale({
165+
code: 'en',
166+
languageISO: 'en-US',
167+
name: 'English',
168+
}),
169+
genFrontendLocale({
170+
code: 'es',
171+
languageISO: 'es-ES',
172+
name: 'Español',
173+
}),
174+
genFrontendLocale({
175+
code: 'fr',
176+
languageISO: 'fr-FR',
177+
name: 'Français',
178+
}),
179+
genFrontendLocale({
180+
code: 'ru',
181+
languageISO: 'ru-RU',
182+
name: 'Русский',
183+
}),
184+
genFrontendLocale({
185+
code: 'vi',
186+
languageISO: 'vi-VN',
187+
name: 'Tiếng Việt',
188+
}),
189+
genFrontendLocale({
190+
code: 'zh-CN',
191+
languageISO: 'zh-CN',
192+
name: '中文',
193+
}),
163194
],
164195
bundle: {
165196
optimizeTranslationDirective: false,

0 commit comments

Comments
 (0)