Language detection should prioritise a base language match over an exact match later in the order

Open
#937 1 comment 0 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
typescript

Research direction

Start by tracing how browser language preferences are matched to the form's button language, especially when the form does not specify a language. Reproduce the case with only es-PA configured; the expected result is Spanish buttons rather than English. The issue does not name a file or test, so locate the language-detection entry point and its related tests before making changes.

Written by the indexing model from the issue text.

Description

Expected Behaviour

Users can configure multiple languages in the browser in the order of preference. These include specific language, such as 'es-PA' for Spanish spoken in Panama. If the user specifies 'es-PA' and the form doesn't define a language, then the form buttons should be in Spanish.

Observed Behaviour

The form buttons are in English.

Reproduction Steps

Steps:

  1. Configure the browser to use 'es-PA' and nothing else
  2. Load a form which doesn't specify a language
Additional Context

Reported on the forum with additional use cases: https://forum.getodk.org/t/web-forms-1-1-1-six-issues-ui-language-fallback-title-wrapping-guidance-hints-region-names-contrast-select-one-external/58660

Dominant language
TypeScript
Stars
38
Forks
24
PR merge metrics
No merged PRs in 30d

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from getodk/web-forms

All issues in getodk/web-forms

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.