From b176ffd32b903a644ae5eb81ac17ecdda1003794 Mon Sep 17 00:00:00 2001 From: hywax Date: Fri, 28 Nov 2025 16:45:35 +0500 Subject: [PATCH 1/4] feat(locale): add British English language --- src/runtime/locale/en_gb.ts | 131 ++++++++++++++++++++++++++++++++++++ src/runtime/locale/index.ts | 1 + 2 files changed, 132 insertions(+) create mode 100644 src/runtime/locale/en_gb.ts diff --git a/src/runtime/locale/en_gb.ts b/src/runtime/locale/en_gb.ts new file mode 100644 index 0000000000..93457ea698 --- /dev/null +++ b/src/runtime/locale/en_gb.ts @@ -0,0 +1,131 @@ +import type { Messages } from '../types' +import { defineLocale } from '../composables/defineLocale' + +export default defineLocale({ + name: 'English (British)', + code: 'en-GB', + messages: { + alert: { + close: 'Close' + }, + authForm: { + hidePassword: 'Hide password', + showPassword: 'Show password', + submit: 'Continue' + }, + banner: { + close: 'Close' + }, + calendar: { + nextMonth: 'Next month', + nextYear: 'Next year', + prevMonth: 'Previous month', + prevYear: 'Previous year' + }, + carousel: { + dots: 'Choose slide to display', + goto: 'Go to slide {slide}', + next: 'Next', + prev: 'Previous' + }, + chatPrompt: { + placeholder: 'Type your message here…' + }, + chatPromptSubmit: { + label: 'Send prompt' + }, + colorMode: { + dark: 'Dark', + light: 'Light', + switchToDark: 'Switch to dark mode', + switchToLight: 'Switch to light mode', + system: 'System' + }, + commandPalette: { + back: 'Back', + close: 'Close', + noData: 'No data', + noMatch: 'No matching data', + placeholder: 'Type a command or search…' + }, + contentSearch: { + links: 'Links', + theme: 'Theme' + }, + contentSearchButton: { + label: 'Search…' + }, + contentToc: { + title: 'On this page' + }, + dashboardSearch: { + theme: 'Theme' + }, + dashboardSearchButton: { + label: 'Search…' + }, + dashboardSidebarCollapse: { + collapse: 'Collapse sidebar', + expand: 'Expand sidebar' + }, + dashboardSidebarToggle: { + close: 'Close sidebar', + open: 'Open sidebar' + }, + error: { + clear: 'Return to home' + }, + fileUpload: { + removeFile: 'Remove {filename}' + }, + header: { + close: 'Close menu', + open: 'Open menu' + }, + inputMenu: { + create: 'Create "{label}"', + noData: 'No data', + noMatch: 'No matching data' + }, + inputNumber: { + decrement: 'Decrement', + increment: 'Increment' + }, + modal: { + close: 'Close' + }, + pricingTable: { + caption: 'Pricing plan comparison' + }, + prose: { + codeCollapse: { + closeText: 'Collapse', + name: 'code', + openText: 'Expand' + }, + collapsible: { + closeText: 'Hide', + name: 'properties', + openText: 'Show' + }, + pre: { + copy: 'Copy code to clipboard' + } + }, + selectMenu: { + create: 'Create "{label}"', + noData: 'No data', + noMatch: 'No matching data', + search: 'Search…' + }, + slideover: { + close: 'Close' + }, + table: { + noData: 'No data' + }, + toast: { + close: 'Close' + } + } +}) diff --git a/src/runtime/locale/index.ts b/src/runtime/locale/index.ts index 94b80fccf2..e60a19ac6d 100644 --- a/src/runtime/locale/index.ts +++ b/src/runtime/locale/index.ts @@ -10,6 +10,7 @@ export { default as de } from './de' export { default as de_ch } from './de_ch' export { default as el } from './el' export { default as en } from './en' +export { default as en_gb } from './en_gb' export { default as es } from './es' export { default as et } from './et' export { default as fa_ir } from './fa_ir' From a6a533a6e811336a551f392384a5acaec145aa85 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 28 Nov 2025 18:14:49 +0500 Subject: [PATCH 2/4] Update src/runtime/locale/en_gb.ts Co-authored-by: Benjamin Canac --- src/runtime/locale/en_gb.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/locale/en_gb.ts b/src/runtime/locale/en_gb.ts index 93457ea698..4c8e74b2c8 100644 --- a/src/runtime/locale/en_gb.ts +++ b/src/runtime/locale/en_gb.ts @@ -2,7 +2,7 @@ import type { Messages } from '../types' import { defineLocale } from '../composables/defineLocale' export default defineLocale({ - name: 'English (British)', + name: 'English (United Kingdom)', code: 'en-GB', messages: { alert: { From 09a750cae477fab0cf5c55f256d8242b0b08d893 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 28 Nov 2025 19:16:36 +0500 Subject: [PATCH 3/4] Update en_gb.ts --- src/runtime/locale/en_gb.ts | 126 +----------------------------------- 1 file changed, 2 insertions(+), 124 deletions(-) diff --git a/src/runtime/locale/en_gb.ts b/src/runtime/locale/en_gb.ts index 4c8e74b2c8..4298c0a9e5 100644 --- a/src/runtime/locale/en_gb.ts +++ b/src/runtime/locale/en_gb.ts @@ -1,131 +1,9 @@ import type { Messages } from '../types' import { defineLocale } from '../composables/defineLocale' +import en from './en' export default defineLocale({ name: 'English (United Kingdom)', code: 'en-GB', - messages: { - alert: { - close: 'Close' - }, - authForm: { - hidePassword: 'Hide password', - showPassword: 'Show password', - submit: 'Continue' - }, - banner: { - close: 'Close' - }, - calendar: { - nextMonth: 'Next month', - nextYear: 'Next year', - prevMonth: 'Previous month', - prevYear: 'Previous year' - }, - carousel: { - dots: 'Choose slide to display', - goto: 'Go to slide {slide}', - next: 'Next', - prev: 'Previous' - }, - chatPrompt: { - placeholder: 'Type your message here…' - }, - chatPromptSubmit: { - label: 'Send prompt' - }, - colorMode: { - dark: 'Dark', - light: 'Light', - switchToDark: 'Switch to dark mode', - switchToLight: 'Switch to light mode', - system: 'System' - }, - commandPalette: { - back: 'Back', - close: 'Close', - noData: 'No data', - noMatch: 'No matching data', - placeholder: 'Type a command or search…' - }, - contentSearch: { - links: 'Links', - theme: 'Theme' - }, - contentSearchButton: { - label: 'Search…' - }, - contentToc: { - title: 'On this page' - }, - dashboardSearch: { - theme: 'Theme' - }, - dashboardSearchButton: { - label: 'Search…' - }, - dashboardSidebarCollapse: { - collapse: 'Collapse sidebar', - expand: 'Expand sidebar' - }, - dashboardSidebarToggle: { - close: 'Close sidebar', - open: 'Open sidebar' - }, - error: { - clear: 'Return to home' - }, - fileUpload: { - removeFile: 'Remove {filename}' - }, - header: { - close: 'Close menu', - open: 'Open menu' - }, - inputMenu: { - create: 'Create "{label}"', - noData: 'No data', - noMatch: 'No matching data' - }, - inputNumber: { - decrement: 'Decrement', - increment: 'Increment' - }, - modal: { - close: 'Close' - }, - pricingTable: { - caption: 'Pricing plan comparison' - }, - prose: { - codeCollapse: { - closeText: 'Collapse', - name: 'code', - openText: 'Expand' - }, - collapsible: { - closeText: 'Hide', - name: 'properties', - openText: 'Show' - }, - pre: { - copy: 'Copy code to clipboard' - } - }, - selectMenu: { - create: 'Create "{label}"', - noData: 'No data', - noMatch: 'No matching data', - search: 'Search…' - }, - slideover: { - close: 'Close' - }, - table: { - noData: 'No data' - }, - toast: { - close: 'Close' - } - } + messages: en.messages }) From f304f06937346926f6ed3ce5e1e8330ca036553b Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Sun, 30 Nov 2025 15:20:05 +0100 Subject: [PATCH 4/4] improve flags display --- .../components/content/SupportedLanguages.vue | 16 ++++++++++++++-- src/runtime/components/locale/LocaleSelect.vue | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/app/components/content/SupportedLanguages.vue b/docs/app/components/content/SupportedLanguages.vue index 2d3bd61c5d..c5261bf4b5 100644 --- a/docs/app/components/content/SupportedLanguages.vue +++ b/docs/app/components/content/SupportedLanguages.vue @@ -16,7 +16,7 @@ function getEmojiFlag(locale: string): string { cs: 'cz', // Czech -> Czech Republic (note: modern country code is actually 'cz') da: 'dk', // Danish -> Denmark el: 'gr', // Greek -> Greece - en: 'gb', // English -> Great Britain + en: 'us', // English -> United States (default) et: 'ee', // Estonian -> Estonia gl: 'es', // Galician -> Spain he: 'il', // Hebrew -> Israel @@ -40,8 +40,20 @@ function getEmojiFlag(locale: string): string { vi: 'vn' // Vietnamese -> Vietnam } + // If locale has a country code (e.g., en-GB), extract and use it + if (locale.includes('-')) { + const countryCode = locale.split('-')[1]?.toLowerCase() + if (countryCode) { + return countryCode.toUpperCase() + .split('') + .map(char => String.fromCodePoint(0x1F1A5 + char.charCodeAt(0))) + .join('') + } + } + + // Otherwise, use the language-to-country mapping const baseLanguage = locale.split('-')[0]?.toLowerCase() || locale - const countryCode = languageToCountry[baseLanguage] || locale.replace(/^.*-/, '').slice(0, 2) + const countryCode = languageToCountry[baseLanguage] || locale.slice(0, 2) return countryCode.toUpperCase() .split('') diff --git a/src/runtime/components/locale/LocaleSelect.vue b/src/runtime/components/locale/LocaleSelect.vue index 550360c368..1cadb3af02 100644 --- a/src/runtime/components/locale/LocaleSelect.vue +++ b/src/runtime/components/locale/LocaleSelect.vue @@ -33,7 +33,7 @@ function getEmojiFlag(locale: string): string { cs: 'cz', // Czech -> Czech Republic (note: modern country code is actually 'cz') da: 'dk', // Danish -> Denmark el: 'gr', // Greek -> Greece - en: 'gb', // English -> Great Britain + en: 'us', // English -> United States (default) et: 'ee', // Estonian -> Estonia gl: 'es', // Galician -> Spain he: 'il', // Hebrew -> Israel @@ -56,8 +56,20 @@ function getEmojiFlag(locale: string): string { vi: 'vn' // Vietnamese -> Vietnam } + // If locale has a country code (e.g., en-GB), extract and use it + if (locale.includes('-')) { + const countryCode = locale.split('-')[1]?.toLowerCase() + if (countryCode) { + return countryCode.toUpperCase() + .split('') + .map(char => String.fromCodePoint(0x1F1A5 + char.charCodeAt(0))) + .join('') + } + } + + // Otherwise, use the language-to-country mapping const baseLanguage = locale.split('-')[0]?.toLowerCase() || locale - const countryCode = languageToCountry[baseLanguage] || locale.replace(/^.*-/, '').slice(0, 2) + const countryCode = languageToCountry[baseLanguage] || locale.slice(0, 2) return countryCode.toUpperCase() .split('')