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

Fallback to English WCAG terms when untranslated #139

Open
remibetin opened this issue Dec 11, 2023 · 6 comments
Open

Fallback to English WCAG terms when untranslated #139

remibetin opened this issue Dec 11, 2023 · 6 comments
Assignees

Comments

@remibetin
Copy link
Member

Updating the tool for WCAG 2.2. meant adding new SCs in wcag.json translated files (Dutch & French versions) for the tool to continue to work in the translated language.

Issues:

Possible solutions:

  • Fallback to English version when there is no translation for WCAG terms (it seems to work like that for UI terms)
  • Declare lang="en" to elements surrounding that content
@remibetin
Copy link
Member Author

@mhansma96 Would you know where the current fallback to English for non-translated UI terms is managed in the code?

@mhansma96
Copy link
Collaborator

@remibetin You might get closer to what you're looking for either here: https://github.com/w3c/wai-wcag-em-report-tool/tree/main/src/locales/en (the English translation folder to set them)

Or here: https://github.com/w3c/wai-wcag-em-report-tool/blob/main/src/components/App.svelte (This is where the context of the app is set and languages are imported)
In addition, one of the translate objects comes from here: https://github.com/w3c/wai-wcag-em-report-tool/blob/main/src/stores/i18nStore.js

@rvantonisse
Copy link
Contributor

Hey, a quick tldr answer: default locale is first locale entered at src/locales/index.json

The file / locales are passed through to i18n initializing script src/scripts/i18n.js and there the first locale is picked as default.

@remibetin
Copy link
Member Author

Thank you very much @mhansma96 & @rvantonisse for your answers. That seems to work for UI terms translations, but not for WCAG guidelines/SC translations though.

@rvantonisse
Copy link
Contributor

Hey @remibetin ,

WCAG does not have fallback translations due to different translation call (I think...)

At src/components/ui/auditor/auditorview.svelte the translations are called on principles and guidelines as json object. In same folder criterion.svelte criterion translations are pulled as object.

This is what I think is the cause. If there is no translation for WCAG2.2 criteria then this will be missing in the criterion json objects.

I would expect the translation plugin used would pull the missing object from the default locale.

There are 2 translation calls, you can find them in src/stores/i18nStore.js. The first works for UI, the second on WCAG.

You may try to call wcag translations with the translate function as normal UI. This looked not possible at the time.

@mhansma96
Copy link
Collaborator

@remibetin remibetin self-assigned this Feb 29, 2024
@remibetin remibetin changed the title [Low] Fallback to English WCAG terms when untranslated Fallback to English WCAG terms when untranslated Apr 16, 2024
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

No branches or pull requests

3 participants