-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add option to disable language autodetect #7953
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
Comments
@markg85 If you have login, you could chose your favorite language that will not obey browser's chose. |
I know, but that's not the request i'm doing here :) |
What your browser preferred language string looks like? |
I suppose you mean the output of "navigator.language" which is in fact "nl". I don't know how it determines that as my system language is English. i do use NL for some settings. Like having a 24 hour clock. So to be very detailed:
But again, i fail to see the point of even telling this. The feature i'm requesting is to have language detection disabled and overruled by the site administrator. Not to debug my browser.. |
You can set preferred languages in browser and Gitea will use it choose default language if you have not set other in user settings |
Please stop. On the other hand, if you can point me to the code that does handle this in Go and the requirements to make the requested feature acceptable then i'd like to give Go a shot and try to implement this. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
Nope, not stale. The issue as described is still there. Some might consider it a feature, i consider it a bug. @guillep2k thank you for your comment, but that is exactly what i described only in text. You added nice pictures to it ;) Anyhow, that's not what i'm looking for. |
@markg85 I keep reading your description and it's still unclear to me what do you actually want. I think that Gitea doesn't autodetect language for the logged in user, so I'm trying to understand your exact problem. Yes, I've read the title, but your message only describes your frustration with software in general. 🤔 There's some context here that I'm missing. For instance, you might be referring to one of the following (there are more):
Can you post a picture of the part that's bothering you? |
@guillep2k oke. Follow my words exactly! So why do i want that? Why do i hate this "feature"? I get that some people consider this a "feature". I just hate it. |
OK, it's clear now. Thank you. 😉 |
@markg85 You can remove all other languages from your app.ini. So that this site will only support one language. |
Now we're going in circles.
I guess the technical term is that i want to disable i18n on the main site without removing the localized translations. I just want to force an overruling default. |
By default Macaron (Web framework Gitea uses) looks at the "Accept-Language" header sent by the browser if nothing is specified otherwise (so for a non-logged in user), and the code for that is here: https://gitea.com/macaron/i18n/src/branch/master/i18n.go#L183 https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language And then Gitea uses that here: gitea/templates/base/head.tmpl Line 2 in 70fa80d
@lafriks point remains that Gitea isn't auto-detecting anything, it is just responding to the browsers specific request for language. The Browser is saying "Send this page in Dutch" (in this example). There isn't a heuristic or anything like that on the Gitea end that makes it guess a language, it just responds with what the browser specifically asks for in the request header. What you'd really be asking for is "Ignore language request my browser sends". As requested, above are the links to the specific code where Gitea eventually uses the header the browser sends if you are interested in modifying it. With the current code you can also force a different language by adding this to the URL query: So to force US English for gitea.com regardless of what your browser sends it would be: That should be enough to then set that language in the users Cookie for other pages, but I haven't tested that in very much detail at all. Alternatively, a custom header template that would force the lang tag to something specific if a user isn't signed in
|
Thank you @mrsdizzie ! I might play a bit with this to get it to my liking. But then again, the inconvenience is really minor. So it's not all that important. Just curious, if i make a feature to set a default i18n override when the user hasn't picked anything, would that be acceptable as a feature for Gitea? Or as you phrased it: "Ignore language request my browser sends". If it is, i might try to make a patch for it. If it's not.. well... why would i bother ;) |
Great glad that helps! Personally I think the two separate workarounds above for this should be enough in this case where somebody wants to ignore what the browser has sent and it wouldn't be worth complicating the code further to add another option. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
This issue has been automatically closed because of inactivity. You can re-open it if needed. |
Hi,
While language autodetect often seems like a nice feature to have (and i'd agree if i never had issues with it), it has it's downsides too.
For instance, i've had the issue for years of being detected as German (i'm dutch, was in the netherlands and was not using a proxy). Even google was at one point in German for me...
So... the feature can be damn pesky if it doesn't work as you'd expect it to work.
i know of the trick to just remove all but english from
LANGS
andNAMES
in thei18n
section, but that's not what i want. As that removes them entirely. I want to be able to choose, just disabling autoconnect and using English by default.Cheers,
Mark
The text was updated successfully, but these errors were encountered: