kubernetes / website

Kubernetes website and documentation repo:
https://kubernetes.io
Creative Commons Attribution 4.0 International
4.45k stars 14.33k forks source link

Kubernetes Documentation: Please observe Accept-Language on search #25782

Open paddy-hack opened 3 years ago

paddy-hack commented 3 years ago

I just hit https://kubernetes.io/search/?q=hostname and got a pile of results including several Japanese results amongst a flurry of English. Most notably, the top result was in Japanese. When I did this at the office, just about all search results were in Japanese.

While I live and work in Japan, I have instructed my web browsers to send an Accept-Language header that states that I want English at home. At the office I prefer English but can live with Japanese. It would be nice if your search functionality actually respected that. Just because the request is coming from an IP address that is ostensibly in Japan doesn't mean a user wants Japanese.

For the record, the header used when hitting the URL above from home was Accept-Language: en-US,en;q=0.5.

:thinking: Maybe I should jack up that q value.

Here's the full request with all headers.

GET /search/?q=hostname HTTP/2
Host: kubernetes.io
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: https://kubernetes.io/search/?q=host
DNT: 1
Connection: keep-alive
Cookie: is_china=false
Upgrade-Insecure-Requests: 1
Sec-GPC: 1
If-None-Match: "8f8033b5be53a0211529ab54d3c57f93-ssl-df"
TE: Trailers
sftim commented 3 years ago

/kind feature

Notes to implementers: This will be hard to implement as stated. We use a content delivery network and the search form is actually a static page with some client side code; implementing a localized search would probably be easiest if done as a fudge where we inspect navigator.languages instead.

Alternatively, we could have a localized search page, so that if you search from https://k8s.io/ja/docs/home/ then the form submission goes to https://k8s.io/ja/search/ and that informs the language choice.

We have taken some steps to make the existing search work for readers in countries with state-level censorship, so we should try to retain that behavior (also remember, we can't assume the presence of absence of state level censorship purely from the reader's preferred language).

paddy-hack commented 3 years ago

countries with state-level censorship

Ah, so that's what the is_china=false in the cookie is about :smile:
However, I repeated the same search at the office and that had is_china=true :astonished:
Last time I checked where the office was, as seen from the receiving end's server, it was definitely somewhere in Japan.

For the record, here's the full request. Note that the referer page shows English as the selected/defaulted language when I fire off the search request. I really expect the top results on the list to be all in English. The first page of ten results turned up nine in Japanese and only the final, tenth result was in English ... :unamused:

:authority: kubernetes.io
:method: GET
:path: /search/?q=hostname
:scheme: https
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
accept-encoding: gzip, deflate, br
accept-language: en-GB,en;q=0.9,ja;q=0.8
cookie: _ga=GA1.2.1117576302.1594939274; _gid=GA1.2.712500492.1608598179; is_china=true; _gat=1; _gat_gtag_UA_36037335_10=1
dnt: 1
if-none-match: "1525fd7682241962374aaaed1439c4c7-ssl-df"
referer: https://kubernetes.io/docs/home/
sec-fetch-dest: document
sec-fetch-mode: navigate
sec-fetch-site: same-origin
sec-fetch-user: ?1
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36
fejta-bot commented 3 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

paddy-hack commented 3 years ago

I sat the Certified Kubernetes Administrator (CKA) exam last week and that allows use of the Kubernetes site's documents. I much prefer not to be side-tracked by search results in languages I don't understand during the exam.

/remove-lifecycle stale

fejta-bot commented 3 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

sftim commented 3 years ago

/priority backlog /triage accepted /lifecycle frozen

A good idea, but it may be years before this reaches the top of the backlog / gets some more attention.

k8s-triage-robot commented 1 year ago

This issue has not been updated in over 1 year, and should be re-triaged.

You can:

For more details on the triage process, see https://www.kubernetes.dev/docs/guide/issue-triage/

/remove-triage accepted

sftim commented 11 months ago

/triage accepted

Again, other work is higher priority.

waipeng commented 8 months ago

I would like to chime in another situation. I visited China for KubeCon and after returning to Australia I realised a bunch of my search results are still in Chinese.

Spent some time trying to figure out why, tried a bunch of things that didn't work

I finally got it to return English search result by using Chrome Developer Tools -> Application -> Cookies, and setting is_china=false. I still do not know how this is set.

I found this page after tracking down the offending cookie. Are there some documentation on this behaviour that I am missing?

avivace commented 6 months ago

Any updates on this? It has been 4+ years and using the internal search still yields a bunch of duplicate, unrelated and distracting results

sftim commented 6 months ago

We (volunteers contributing to the Kubernetes project) haven't prioritized this work. However, help is very welcome. If anyone wants advice about how to work on this, please ask.

sftim commented 6 months ago

/area localization