fix native language initial config and persistence #308
No reviewers
Labels
No labels
a11y
Bug
Bug fix
Critical Priority
Documentation
Feature
Feature request
Held for next release cycle
High Priority
Low Priority
Medium Priority
Minor change
Translation/Locale
WIP
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma-fe#308
Loading…
Reference in a new issue
No description provided.
Delete branch "denys/akkoma-fe:fix-native-language"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #305
i'm not sure this one quite works
a browser's languages will be listed in priority order, for example i have mine set to
en-GB, ja-JA
the way this is currently implemented works for non-native-english-speakers, but not native english speakers that speak another language - since it will select the first non-english, in my case,
ja-JA
, when i would expecten-GB
, it being my primary language and all98a1f44024
toae6fe3c5c8
Added a respective branch, please try.
For the record:
ja-JA; en-GB; fr-FR
and instance language set ofen; it;
would still yield unexpected results afaict.Thanks for your review! I can reproduce the dispatch lack that you're describing, and I didn't notice it at the time of writing the patch. However, my patch addresses another part of the issue, namely client-side persistence for users who are not members of the instance but read it once in a while, for example by clicking links from another instance to open complete original threads in background tabs. Instances can reject guest state storage with a 403, but the cookie survives through that, and also the cookie can help the static renderer (I think). And I'd like to add emphasis that special-casing English is what de facto happens by neglecting the user's language, rushing to fall back to English as early as possible. While I read mainly international instances with mostly English-language posts, that doesn't mean I expect their UI to disregard my preference for my language, which I explicitly configure my browser to ask every website for.
if it wasn’t clear btw, my opinion has no influence on what gets merged, i’m just offering my point of view here
That’s not what happens atm though. It takes a look at the list of languages configured in the user’s browser and the list of languages supplied by the instance admin and takes the first entry in the user’s list which overlaps with the instance languages. If they have no entry in common, the most preferred language of the instace admin gets chosen. None of this is hardcoded to English.
The only "special-casing" of English in the current code are afaiu:
en
; since this is almost immediately overwritten again, it doesn’t matter in practiceOfc, this doesn’t suit everyone, which is why instance admins can and should customise this to match what’s being understood and used on the instance. The
["en"]
default is only used when admins didn’t configure this.Your current patch meanwhile, blindly assumes no users want’s to see English if it’s not their first entry. As pointed out above this leads to nonsense results in all cases where English appears at a different place.
I have no issue and think it’d be a good idea to persist explicit configuration by logged-out users, e.g. in the browser’s storage or some other local form. However:
Does it? When I edit the cookie on my end (when not logged in) to use a different langauge and match your adjustments, then reload the page it always gets overwritten again with the value from the frontend config.
Have you tried persisting a value not in your browser locales?
Frontend settings are stored as a JSON blob in the browser’s indexdb, but atm get discarded after the session. I believe, if you could figure out why they get discarded and make them persist instead (while not breaking configs for users logging in), this seems like the ideal outcome to me.
Stuff will default to the common denominator between admins and the user, probably also somewhat matching the primary post languages, but explicit configuration for other interface languages persists even for logged-out users.
I appreciate your opinion nonetheless; your understanding of the engine is more up-to-date and thorough. I haven't contributed since my instance got nuked by Google Safe Browsing quite early in its existence. I spent a month trying to recover the organization domain, and Google only relented after I deleted all my opinions and Akkoma itself.
From what I observe, that is a source of systemic bias in favor of English (browser weights contain English by default, and fedi instances are predominantly US/UK/EU-owned while being explored by people from the periphery countries), and I disagree with you calling my expected result a nonsense result. If the user sets Japanese as their primary preference for the web, and the web application they open contains a Japanese translation, I think they should see a Japanese UI. I like that Forgejo behaves this way.
Tbh no.
If this is your goal, then the current patch does not achieve this. It still tries to find a match between browser and instance language first before defaulting to the user’s preferred language. So it can happen a non-preferred language is chosen (which the user might only understand to a limited degree).
Only specifically English is treated differently here and entirely discarded from the user preference, leading to the previously mentioned problems.
Now that I think about it, the defaulting to browser language is also not safe, as there might not even be a translation for it. To align with your stated goal, i guess you’d need to also search the full list of translations for the best match.
I’m calling the results of the current patch nonsensical. I doubt this is the result you expect, but it’s what will currently happen.
For more examples of what nonsense this patch yields consider the following two:
This results in trying to get an Ainu translation (which does not exist (yet))
and then the interface will probably be forced to fallback to English,
i.e. a language understood by neither instance admins nor the user
(atm it choose Arabic instead, matching admins and likely posts)
User indicates a very weak preference for Vietnamese and
and both instance and user have a much stronger preference for English.
However, due to the filtering from this patch, Vietnamese will be chosen instead, which the user might only barely understand.
(atm English will be chosen, which both understand well)
On a more general note:
This will ofc come down to personal preference, but I like the logic of trying to match user and instance language and defaulting to the instance language. Unlike some other websites, the primary content on an Akkoma instance are the posts and bios of users and those tend to match the instance languages as they form a community.
A bit different but similar logic applies to e.g. online newspapers. The frameworks used to built their sites may contain translations for many languages for basic UI elements, but to match the content ime everything always matches the article language.
Forgejo’s main content is code and can contains projects by many different people and organisations. There’s often not much overlap between different projects (not from the same org) and they might all converse in different natural languages. Therefore there’s no inherent primary natural language to use and no expectation of consistency. Defaulting to the user’s primary language is the only sane choice here.
Ofc, if someone explicitly configured another choice, this should persist, but the current patch does not achieve this.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.