Bug 451081 - kde.org should get system language and offer the localised version automatically
Summary: kde.org should get system language and offer the localised version automatically
Status: RESOLVED FIXED
Alias: None
Product: www.kde.org
Classification: Websites
Component: general (show other bugs)
Version: unspecified
Platform: Other All
: NOR wishlist
Target Milestone: ---
Assignee: kde-www mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-03 12:14 UTC by Emir SARI
Modified: 2022-04-09 13:47 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Emir SARI 2022-03-03 12:14:22 UTC
SUMMARY

kde.org website opens in English by default. This is an undesirable behaviour. Instead, it should check the appropriate system locale, and display the localised version if available.

Also, since the language selection is also in English "Languages", it is not intuitive for a non-English speaker to find. The icon does not help in this case.

STEPS TO REPRODUCE

1.  Visit kde.org with a non-English system

OBSERVED RESULT

The website displays in English by default.

EXPECTED RESULT

The website should have displayed the localised version.

SOFTWARE/OS VERSIONS

macOS: 12.2.1
Latest Safari and Firefox
Comment 1 Ben Cooksley 2022-03-22 09:23:01 UTC
While i'm not 100% familiar with how translation for our Hugo based websites is done, this is how I solved it for docs.krita.org:
https://invent.kde.org/documentation/docs-krita-org/-/blob/master/404handler.php

Note that this basically can't be done with Apache redirect rules due to all the special cases around language variants - especially for zh_* languages.
Comment 2 Phu H. Nguyen 2022-03-30 00:37:02 UTC
Git commit b972e36b9529e2f6b6879bc5243b3c245d0a1a1c by Phu Nguyen.
Committed on 30/03/2022 at 00:36.
Pushed by phunh into branch 'master'.

Bump up kde-hugo
Related: bug 429638
The system language is non-trivial to get, and the browser language is
apparently good enough.
Although this does not do what the bug report suggested, it solves the
problem that the bug report is likely concerned about.

M  +0    -6    config.yaml
M  +1    -1    go.mod
M  +2    -2    go.sum

https://invent.kde.org/websites/kde-org/commit/b972e36b9529e2f6b6879bc5243b3c245d0a1a1c
Comment 3 Emir SARI 2022-03-30 06:54:30 UTC
Thanks everyone!
Comment 4 Emir SARI 2022-04-09 08:13:35 UTC
For the other project sites like Plasma Mobile (at least the ones directly linked from kde.org, excluding individual application websites), shall I open a separate ticket or modify and reopen this one?
Comment 5 Phu H. Nguyen 2022-04-09 10:43:01 UTC
(In reply to emir_sari from comment #4)
> For the other project sites like Plasma Mobile (at least the ones directly
> linked from kde.org, excluding individual application websites), shall I
> open a separate ticket or modify and reopen this one?

The fix has been applied to our most popular sites (Hugo-based sites), including plasma-mobile.org. Could you check again?

Other sites will automatically get this feature when and if they are converted to Hugo.
Comment 6 Emir SARI 2022-04-09 11:46:30 UTC
Hmm, curious. Not only Plasma Mobile website; but I emptied all cache, and visited kde.org, and it did not change language as well. Maybe the change did not reflect yet? It works with other localised web pages, so it should be working.
Comment 7 Phu H. Nguyen 2022-04-09 12:22:47 UTC
(In reply to emir_sari from comment #6)
> Hmm, curious. Not only Plasma Mobile website; but I emptied all cache, and
> visited kde.org, and it did not change language as well. Maybe the change
> did not reflect yet? It works with other localised web pages, so it should
> be working.

Have you ever chosen a language in the language selector of kde.org? If yes, an item is set in your local storage for the site, maybe emptying the cache still leaves that behind.

What language do you select in your browser for displaying pages?
Comment 8 Emir SARI 2022-04-09 12:34:19 UTC
Tried under Safari 15.4 and Firefox 98.0.2 KDE; both set to Turkish, all caches cleared.
Comment 9 Emir SARI 2022-04-09 12:37:07 UTC
(In reply to Emir Sarı from comment #8)
> Tried under Safari 15.4 and Firefox 98.0.2 KDE; both set to Turkish, all caches cleared.

Sorry for the spam-forgot to mention; haven't selected a language from kde.org selector after clearing the caches, above Turkish is the system/browser setting.
Comment 10 Phu H. Nguyen 2022-04-09 12:53:59 UTC
(In reply to Emir Sarı from comment #9)
> Sorry for the spam-forgot to mention; haven't selected a language from
> kde.org selector after clearing the caches, above Turkish is the
> system/browser setting.

As I said, clearing the cache doesn't remove the item from the site's local storage. For Firefox, could you click on the lock icon on the left of the URL then "Clear cookies and site data..."?

As for the browser language, please make sure you set the language for displaying pages, not the language to display menus, messages, and notifications from Firefox.
Comment 11 Phu H. Nguyen 2022-04-09 12:58:05 UTC
Or let's do it like this: open the Web Developer Tools (press Ctrl+Shift+i), change to Console tab, there should be a pair of language codes there, in the form of "A - B". Tell me what are A and B.
Comment 12 Emir SARI 2022-04-09 13:03:48 UTC
(In reply to Phu H. Nguyen from comment #10)
> As I said, clearing the cache doesn't remove the item from the site's local
> storage. For Firefox, could you click on the lock icon on the left of the
> URL then "Clear cookies and site data..."?

Greyed out, already clear I presume.

> As for the browser language, please make sure you set the language for
> displaying pages, not the language to display menus, messages, and
> notifications from Firefox.

Yes, it's set for displaying pages.

(In reply to Phu H. Nguyen from comment #11)
> Or let's do it like this: open the Web Developer Tools (press Ctrl+Shift+i),
> change to Console tab, there should be a pair of language codes there, in
> the form of "A - B". Tell me what are A and B.

`tr-TR - tr-tr`
Comment 13 Phu H. Nguyen 2022-04-09 13:14:28 UTC
Git commit 29c63557498912ea1fd9fa2a53159090f3228d99 by Phu Nguyen.
Committed on 09/04/2022 at 13:14.
Pushed by phunh into branch 'master'.

Bump kde-hugo

M  +1    -1    go.mod
M  +2    -2    go.sum

https://invent.kde.org/websites/kde-org/commit/29c63557498912ea1fd9fa2a53159090f3228d99
Comment 14 Phu H. Nguyen 2022-04-09 13:18:19 UTC
(In reply to Emir Sarı from comment #12)
> `tr-TR - tr-tr`

Many thanks for your answers. The problem lies in the language code: we haven't handled the case of "tr-TR". I have applied a fix for kde.org, and will do for other sites when you check that kde.org is fine.

Is that the code you got on Safari? I suppose on Firefox you got tr only, right? I don't see any tr-XX code on Firefox.
Comment 15 Emir SARI 2022-04-09 13:21:34 UTC
Now it’s working as expected! Thank you very much.

> Is that the code you got on Safari? I suppose on Firefox you got tr only, right? I don't see any tr-XX code on Firefox.

No, that was Firefox. On Safari I get `tr-TR - tr`.
Comment 16 Phu H. Nguyen 2022-04-09 13:30:28 UTC
(In reply to Emir Sarı from comment #15)
> Now it’s working as expected! Thank you very much.
> 
> > Is that the code you got on Safari? I suppose on Firefox you got tr only, right? I don't see any tr-XX code on Firefox.
> 
> No, that was Firefox. On Safari I get `tr-TR - tr`.

Glad it works! Thanks for your support too!

And TIL other than tr-TR, there is tr-CY too.
Comment 17 Phu H. Nguyen 2022-04-09 13:47:02 UTC
Git commit 03a31ab05bbbdaa99a1d4010fd148a330e9051ee by Phu Nguyen.
Committed on 09/04/2022 at 13:44.
Pushed by phunh into branch 'master'.

Bump kde-hugo

M  +1    -1    go.mod
M  +2    -2    go.sum

https://invent.kde.org/websites/apps-kde-org/commit/03a31ab05bbbdaa99a1d4010fd148a330e9051ee
Comment 18 Phu H. Nguyen 2022-04-09 13:47:17 UTC
Git commit 4acf67a51f77dabb612d6f7bcc2b52e9f5128fc8 by Phu Nguyen.
Committed on 09/04/2022 at 13:46.
Pushed by phunh into branch 'master'.

Bump kde-hugo

M  +1    -1    go.mod
M  +2    -2    go.sum

https://invent.kde.org/websites/okular-kde-org/commit/4acf67a51f77dabb612d6f7bcc2b52e9f5128fc8
Comment 19 Phu H. Nguyen 2022-04-09 13:47:24 UTC
Git commit 863beed1089beef5699ae4d17954f3321eb4a53c by Phu Nguyen.
Committed on 09/04/2022 at 13:46.
Pushed by phunh into branch 'master'.

Bump kde-hugo

M  +1    -1    go.mod
M  +2    -2    go.sum

https://invent.kde.org/websites/plasma-mobile-org/commit/863beed1089beef5699ae4d17954f3321eb4a53c