Skip to content

Conversation

@joeljkrb
Copy link
Collaborator

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.

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.
Copy link
Collaborator

@rossbulat rossbulat left a 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 -gb suffix in the en locale files only.
  • Add a mapping of locales -> suffixes, and add checks to the validate script 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 language en-GB
  • Checks if there is a suffix defined via the suffixes mapping
  • 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.

joeljkrb added 3 commits May 5, 2025 14:29
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
@rossbulat rossbulat requested a review from Copilot June 7, 2025 03:17
Copy link
Contributor

Copilot AI left a 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.

@joeljkrb joeljkrb marked this pull request as ready for review June 7, 2025 15:35
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

Successfully merging this pull request may close these issues.

3 participants