When logged in, the language setting switches correctly. setting 'faker_locale' doesn't make a difference.
However, if there is no language setting option on the main page, should it be displayed based on the admin's settings?
I have uploaded the Traditional Chinese (zh-Hant) language pack, but I am not familiar with PR operations. Perhaps you can assist in confirming.
@Toby
https://github.com/efast1568/core/tree/main/lang
5 Comments
I'm not sure I quite understand the problem, so I'll just explain how the language system works.
In order to become available, languages must be registered using the
Locales
extender. For example, inWaterholeServiceProvider
, you would add:Waterhole uses the following algorithm to determine which language to use:
Accept-Language
header sent by the browser.The
app.locale
setting is not actually used for Waterhole requests.You should keep
app.fallback_locale
set toen
so that any strings that don't have azh
translation will fall back to English instead of printing out the translation key.I know why we misunderstood...
It's so small that I didn't notice it
especially when the navi bar is a bit long...
Can we specify a default language?
In most cases you shouldn't need to, since Waterhole defaults to the closest matching preferred language to the
Accept-Language
header sent by the browser. If there's no good match, it will default to the first locale defined inExtend\Locales
(English). If you needed to change this you could remove the English locale:After several days of testing and interaction with other site admins, we suggest that it is still necessary to have a "default" language parameter instead of removing the "EN" language option.
In most non-English operating systems, browsers cannot accurately determine the language automatically.
This situation is similar to some flrum extensions where, in our usage environment, the current language cannot be automatically detected.
Alternatively, there are scenarios where users are accustomed to operating in an English environment but visit a new discussion forum where they would like to see the familiar language menu directly.
Furthermore, English is the primary international language and it serves a necessary purpose.
Therefore, if circumstances permit, having a default language option would be a popular choice.
Update Note:
In some non-EN language environments, Accept-Language may not be correctly detected.
If you need to change the default language, try modify the following code.
/Middleware/Localize.php
remove: $request->getPreferredLanguage($locales)