codeforcroatia / codeforcroatia.org

[Deprecated] Extended project of Laddr for Code for Croatia website
https://codeforcroatia.org
1 stars 2 forks source link

Set Croatian as default language for CfC #52

Closed schlos closed 3 years ago

schlos commented 3 years ago

Info from Chris regarding setting default language in https://github.com/codeforcroatia/codeforcroatia.org/blob/emergence/vfs-site/master/php-classes/Emergence/Locale.php#L11:

schlos commented 3 years ago

TBC: https://github.com/codeforcroatia/codeforcroatia.org/blob/master/php-config/Emergence/Locale.config.php via https://github.com/codeforcroatia/codeforcroatia.org/commit/4c9c2c2565d06d05fb6f71cb01c1dfc3a23f8e3a

schlos commented 3 years ago

It still loads site with a Croatian as default language: http://cfc-staging-v3.poplar.phl.io/

schlos commented 3 years ago

Auto-language selection works with

Accept-Language header:

Mod headers with ModHeader: https://chrome.google.com/webstore/detail/modheader/idgpnmonknjnojddfkpgkljpfnnfcklj/

schlos commented 3 years ago

I would probably make new PR upstream to change https://github.com/codeforcroatia/codeforcroatia.org/blob/emergence/vfs-site/master/php-classes/Emergence/Locale.php so that we have initial setting with primary language and if it's set, then page will always initially load in predefined primary language.

schlos commented 3 years ago

There is bug because it will fall back always to en_US rather than configured language in php-config: https://github.com/codeforcroatia/codeforcroatia.org/blob/master/php-config/Emergence/Locale.config.php It seems this configuration is not overriding default set value in Locale.php.

i.e. Accept-Language header is set to de_DE,de --> site will be displayed in en_US

New primary language feature will be tracked via separate issue https://github.com/codeforcroatia/codeforcroatia.org/issues/53

schlos commented 3 years ago

Check what is my Request headers (Accept-Language): https://manytools.org/http-html-text/http-request-headers/

Before test:

Device 1: Request headers

Device 2: Request headers

Device 3: Request headers

schlos commented 3 years ago

Try with: https://github.com/codeforcroatia/codeforcroatia.org/commit/6d2751bb7feeb3b064916fb98d61ae2951d0d6e2

schlos commented 3 years ago

Done with https://github.com/codeforcroatia/codeforcroatia.org/commit/ac631cc13715ca31f45b06ab7f799029dbd5e72d and https://github.com/codeforcroatia/codeforcroatia.org/commit/4c9c2c2565d06d05fb6f71cb01c1dfc3a23f8e3a