-
Notifications
You must be signed in to change notification settings - Fork 48
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
translations are out of sync (and always fallbacks to English) #177
Comments
This is odd, I definitely see the French strings here: If you can reproduce this consistently in the browser, can you please send me the details of the request you're making? If you're familiar with the browser developer tools, you can right-click the request and select "Copy > Copy as cURL" to get something like:
That would make it easier for me to see the request and hopefully reproduce the bug. I'm especially interested in the Accept-Language header. |
You are using a Mac (as seen on your screenshot). I am using Google Chrome (last version) on Windows 11 Pro. General
Response Headers
Request headers
|
As you see there's "accept-language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7" In summary, the browser's language list is: "fr-FR, fr, en-US, en" It seems that you do not honor "fr-FR" and stop there (not honoring "fr" given just after) and fallback instantly to English only, EVEN if the URL was requesting the French page (https://citationhunt.toolforge.org/fr), whose effect is only to select the language to select sets of citations from Wikimedia pages (but it has NO effect on the UI of your webapp). I can use the language selector at top to select German, and I see German (and with the same "Accept-Language:" header), when I use that selector again to select French, I only see English. You seem to confuse the UI language, and the language to use for selecting sets of citations in Wikimedia page with assumption that the Wikimedia language would match the 1st language in Accept-Language. But here you detect "fr-FR", which matches partially "fr" from the selected Wikimedia citation sets. But then the code does not properly load the "fr" resources and attempts to locate "fr-FR" resources (taken from the 1st partial match in Accept-Language), does not find them, and instantly fallbacks to using resources for the English locale. And I can easily reproduce it if now I setup my browser for Swiss German with "Accept-Language: de-CH, de, en-US, en", then I cannot see the German UI, only the English UI (but for Wikimedia citations in German) Your language selector then does not work for any selected language that partially matches an Accept-Language entry with a country extension (and such case is VERY frequent in ALL modern browsers that have user settings for Accept-Language). I have the same issue not just in Google Chrome, but also in MS Edge, or Firefox; and not just on Windows, also in Linux, and Android (I can't test with MacOS or iOS). This is clearly an issue of your webapp code, unable to select the correct locale for its UI: if you have a partial match on "fr-FR" for a known UI language like "fr" that you support, you should use "fr" (not "fr-FR"), to load the UI locale data; and you should not fallback to English in any case, but to the language of the Wikimedia citation set (as defined by the "/fr" webpage URL defined by the language selector) |
Apparently the bug is in https://github.com/eggpi/citationhunt/blob/master/handlers/common.py in function starting on line 41: it finds a partial match "fr" when parsing the Accept-Language, but then returns exactly its value (which has extensions like "-FR"), i.e. it returns "fr-FR" instead of "fr" (the code that you support and that was partially matched). Later in the code initialisation, you can't locate resources in "fr-FR", and fallback to loading English only. |
Thank you! I can reproduce it with your Accept-Language and this looks like a regression caused by 6bc5d6b. I think this is the relevant chunk of the code. Prior to 6bc5d6b, So, before, we would:
But now, we try to load 'fr-FR.json' and get back the fallback English strings as if nothing happened. I'll take another look at this in the next couple of days, but it should be an easy fix. We should make sure to add a test for this. |
Note: you don't display any logo for your app. https://translatewiki.net/wiki/File:CitationHunt.png https://translatewiki.net/wiki/Translating:CitationHunt This is because before, all we had was a screenshot, which did not allow a clear identification in a "Babel" templates (that are limtied to 45x45px), such as this: May be you have a better concept or design. I just made it as a very simplified derivation of your UI. It may probablybe enhanced, or I could make the change if your prefer other colors, or if you ntend to change/improve the UI. I could also reduce the screenshot size displayed in the portal (eliminating large white margins, so that the essential parts are visible, even on a narrow screen): |
Many translations made since long in Translatewiki.net are NOT loaded in the repository. So the interface still shows English almost everywhere.
It seems that you do not import these translations either:
Apparently you've got problems to manage the synchronization (a project repository management problem, affecting all languages) and language fallbacks and message loaders (an undetected programming bug, affecting some languages for unknown reason).
If you don't want to pollute your local curated version, you should IMHO at least create a code branch in GitHub for incoming translations (and make sure it remains constantly in sync with TWN), so that you can still use the branch comparing tools of GitHub to see the differences with your main branch and have a way to trace the work you need.
As a consequence, the online version of the tool displays English in static places.
Example here in French: no French at all displayed anywhere, even if its translation is complete in TWN, but partial/out of sync in your GitHub repository, and on the deployed web site of your tool)
The text was updated successfully, but these errors were encountered: