-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
make sure force language is reflected in html lang attribute #9435
Conversation
lib/private/L10N/Factory.php
Outdated
@@ -130,6 +130,13 @@ public function findLanguage($app = null) { | |||
return $this->requestLanguage; | |||
} | |||
|
|||
$forceLang = $this->config->getSystemValue('force_language', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this not be at the top if the language is forced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and i guess the block from get
can be removed then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this not be at the top if the language is forced?
@rullzer No, because the statement above caches the selected language. $this->requestLanguage
is ever only set inside findLanguage()
and never from the outside. If we put the forceLang statement on top, it would check on every call if the language exists, which requires fs access and should thereby be avoided.
and i guess the block from get can be removed then?
@nickvergessen No, because both get()
and findLanguage()
are public methods and can be used individually without each other. get()
should still respect forceLang
even if an app requests a specific language. Let's say forceLang = de
, but an app requests get(dav, en)
, it should return a german L10N object.
Codecov Report
@@ Coverage Diff @@
## master #9435 +/- ##
===========================================
+ Coverage 51.7% 51.7% +<.01%
- Complexity 25760 25762 +2
===========================================
Files 1644 1644
Lines 96578 96582 +4
Branches 1394 1394
===========================================
+ Hits 49935 49939 +4
Misses 46643 46643
|
Signed-off-by: Georg Ehrke <[email protected]>
17337b7
to
2a21471
Compare
Signed-off-by: Roeland Jago Douma <[email protected]>
@georgehrke I pushed a fix. Basically if force_language is set we always set it at the beginning of this function. (cheap call anyway). Else if the first call is to an app that doesn't have the force language the requestLanguage will be set to the userLanguage (if that does exist) and it will not work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works now 👍 Also the code makes sense
@rullzer makes sense :) |
Steps to reproduce:
force_language
in config.php (e.g. tode
)lang
attribute of thehtml
element.before:

after:

Ref: https://help.nextcloud.com/t/spracheinstellung-im-kalender/30969/16