Skip to content
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

Add translation support for UI components based on browser locale #332

Open
5 tasks
latin-panda opened this issue Mar 11, 2025 · 1 comment
Open
5 tasks

Comments

@latin-panda
Copy link
Collaborator

latin-panda commented Mar 11, 2025

Description

Currently, UI components such as buttons, labels, and other text elements (e.g., the PrimeVue Calendar component) do not adapt to the user’s browser language. To improve internationalization (i18n), these components should display text in the language corresponding to the browser’s locale (e.g., navigator.language). This will enhance the user experience by providing a localized interface without requiring manual language selection.

Calendar Geopoint

User Story

As a user,
I want all UI elements on the screen (e.g., buttons, labels, calendar labels) to automatically display in my native language based on my browser’s locale,
So that I can interact with the application in a familiar and comfortable way without needing to manually set my language preference.

Considerations

  • PrimeVue has a configuration to define the language as json. There is a project already providing translations to many languages, but it seems heavy (1MB unpacked)
    • We can take some of these translations to keep the bundle light.
  • Not all components are PrimeVue, and they still need translations (Geopoint). Search by TODO: translations to find places where translations are needed.
  • The browser’s locale is determined using navigator.language (e.g., "en-US" → "en").
  • Only static UI text (e.g., button labels, calendar labels) needs translation at this stage; dynamic content is translated in the form definition.
  • A fallback language (English) is acceptable when the user’s locale is unsupported.

Tasks

  • Design: Design a uniform solution for all components (PrimeVue and non-PrimeVue components)
  • Define Translations: Define languages and create a translation object/map covering buttons, labels, etc.
  • Test: Create a test plan. Verify the UI updates correctly when switching browser languages (e.g., English → Spanish → French).
  • Implementation: Add logic to detect the browser’s language using navigator.language and map it to supported locales. Ensure buttons, labels, and other UI elements use the detected locale’s translations.
  • Documentation: Update the project’s README or developer guide with instructions on adding new languages.
@lognaturel
Copy link
Member

We may want to consider something like the host application managing and serving translations as requested. For example, if my browser locale is XYZ, the host application would be responsible for providing translations just for locale XYZ to WF and might request it from a backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

2 participants