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

Default UI language is resolved in the frontend #1044

Merged
merged 5 commits into from
Jan 31, 2024

Conversation

veloman-yunkan
Copy link
Collaborator

Fixes #1038
Fixes #1039

This change makes the viewer resolve the default UI language in the front end, without any dependence on the backend's handling of the Accept-Language header. Yet, the latter has not been removed since it is currently used in the following scenarios:

  • /nojs endpoint
  • error responses (e.g. /invalid_endpoint, or any other invalid kiwix-serve URL directly loaded in the browser rather than via the Kiwix JS viewer).

Copy link

codecov bot commented Jan 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 39.35%. Comparing base (aff801e) to head (c697611).
Report is 134 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1044   +/-   ##
=======================================
  Coverage   39.34%   39.35%           
=======================================
  Files          58       58           
  Lines        4061     4060    -1     
  Branches     2237     2236    -1     
=======================================
  Hits         1598     1598           
  Misses       1091     1091           
+ Partials     1372     1371    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

static/generate_i18n_resources_list.py Outdated Show resolved Hide resolved
static/skin/i18n.js Outdated Show resolved Hide resolved
Copy link
Member

@rgaudin rgaudin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on @mgautierfr's feedback

static/generate_i18n_resources_list.py Outdated Show resolved Hide resolved
static/generate_i18n_resources_list.py Outdated Show resolved Hide resolved
static/skin/i18n.js Outdated Show resolved Hide resolved
@veloman-yunkan
Copy link
Collaborator Author

veloman-yunkan commented Jan 30, 2024

Reminder to myself - translatewiki PR #1033 has been merged, so languages.js must be regenerated during rebase&fixup.

@mgautierfr
Copy link
Member

Please rebase-fixup.

... so that extra info about the count of translated strings can be
added.

Note that due to increased size skin/languages.js lost its
too-small-to-be-worth-compressing status.
Note that static/skin/languages.js must be generated/updated manually
by running the static/generate_i18n_resources_list.py script. Previously
it had to be done only when new languages were added. Now the
translation counts will also need to be updated when new entries are
added to static/skin/i18n/en.json or upon merging a few translatewiki PRs.
This change eliminates any need for defaultUserLanguage in
viewer_settings.js.
@veloman-yunkan veloman-yunkan force-pushed the default_ui_language_is_resolved_in_the_frontend branch from 026a55a to c697611 Compare January 31, 2024 13:56
@veloman-yunkan
Copy link
Collaborator Author

Reminder to myself - translatewiki PR #1033 has been merged, so languages.js must be regenerated during rebase&fixup.

Done

@veloman-yunkan
Copy link
Collaborator Author

Please rebase-fixup.

@mgautierfr Done

@mgautierfr mgautierfr merged commit 795fcb9 into main Jan 31, 2024
16 checks passed
@mgautierfr mgautierfr deleted the default_ui_language_is_resolved_in_the_frontend branch January 31, 2024 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants