-
Notifications
You must be signed in to change notification settings - Fork 187
feat(locales): add English (UK) localisation #2674
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
base: main
Are you sure you want to change the base?
Conversation
Added British English language option to enhance user experience for UK users. Changes include: - Created British English (enGB) translation files - Updated language selection UI to display English (US) and English (UK) options - Ensured proper spacing and responsive layout in language selector - Set up automatic detection for en-GB browser settings This improves the dashboard's accessibility for British users while maintaining the existing US English localisation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating a locale folder specifically for GB, I wonder if there is a way we can just amend the affected locale keys in question by:
- Providing a
-gbsuffix in theenlocale files only. - Add a mapping of
locales -> suffixes, and add checks to thevalidatescript to prevent missing key errors - Where we expect these localised keys to be used (for any language, not just
en), call a helper function that either takes the expected prefixed key, or returns the fallback.
withSuffix('key') => key | keyWithSuffix
Given:
const suffixes: Record<string, Record<string, string>> = {
en: {
'en-GB: 'gb' // within "en" locale, the "en-GB" language is supported with the "gb" suffix
}
}
And given en locale and en-GB language is active, withSuffix:
- Gets the currently active locale key
en, and the active languageen-GB - Checks if there is a suffix defined via the
suffixesmapping - Checks if the suffixed key exists, and returns it if it does, otherwise returns unsuffixed key
We then just deal with the affected keys without as much duplication.
Added a suffix-based approach to support language variants like British English (en-GB) without duplicating entire locale files. This approach only requires defining the specific keys that differ between variants. Key changes: - Created suffix mappings and withSuffix helper to dynamically select locale variants - Updated language detection to work with browser variants - Added UI support for selecting language variants - Modified validation scripts to handle suffixed keys - Added British English suffixed keys to demonstrate the approach - Created documentation explaining the suffix system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Added British English language option to enhance user experience for UK users.
Changes include:
This improves the dashboard's accessibility for British users while maintaining the existing US English localisation.