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

Always use fallback language strings, in case specified language is missing any keys #2050

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

audiodude
Copy link
Member

Fixes #2046

The source of this bug is a missing DISCLAIMER key in https://github.com/openzim/mwoffliner/blob/main/translation/fi.json and similar missing fields in ar.json.

The current "fallback" logic of getStringsForLang is that, if the requested language file is completely missing (reading the file throws an error), use en.

This PR makes it so that the fallback (en or whatever is specified) is used by default for all necessary strings, then specific strings that are available in a translation file override the en strings.

@kelson42
Copy link
Collaborator

@audiodude Does it fix #1998 to your opinion?

@audiodude
Copy link
Member Author

@audiodude Does it fix #1998 to your opinion?

Let me check real quick.

@audiodude
Copy link
Member Author

@audiodude Does it fix #1998 to your opinion?

Let me check real quick.

I can't verify https://scn.vikidia.org/ because it is behind Cloudflare, so mwoffliner gets a 403 because it can't pass the CAPTCHA.

@audiodude audiodude requested a review from kelson42 June 28, 2024 17:52
Copy link
Collaborator

@kelson42 kelson42 left a comment

Choose a reason for hiding this comment

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

LGTM

@kelson42 kelson42 merged commit 4cfe89b into main Jun 28, 2024
4 checks passed
@kelson42 kelson42 deleted the bug-2046 branch June 28, 2024 18:30
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.

Cannot read properties of undefined (reading 'replace')
2 participants