aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-09-18 11:13:30 +0200
committerJoas Schilling <coding@schilljs.com>2024-09-23 17:00:07 +0200
commit82566c5479b7cf3374501a1e6b113680ae75afee (patch)
tree697896f4b5d64a1a1b77e5a50a13a4274c793e30 /lib
parent242f89afb3312f04bbbf7951d9a71092f15978a1 (diff)
downloadnextcloud-server-82566c5479b7cf3374501a1e6b113680ae75afee.tar.gz
nextcloud-server-82566c5479b7cf3374501a1e6b113680ae75afee.zip
fix(rtl): Make clear that the direction is based on languagefeat/31420/bidi-backend-support
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/L10N/Factory.php5
-rw-r--r--lib/private/TemplateLayout.php2
-rw-r--r--lib/public/L10N/IFactory.php6
3 files changed, 6 insertions, 7 deletions
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php
index ea6360efdf0..a519ae7e761 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -377,9 +377,8 @@ class Factory implements IFactory {
return in_array($lang, $languages);
}
-
- public function getLanguageDirectionFromLocale(string $locale): string {
- if (in_array($locale, self::RTL_LANGUAGES)) {
+ public function getLanguageDirection(string $language): string {
+ if (in_array($language, self::RTL_LANGUAGES, true)) {
return 'rtl';
}
diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php
index bca9af16d22..60c7526435e 100644
--- a/lib/private/TemplateLayout.php
+++ b/lib/private/TemplateLayout.php
@@ -196,7 +196,7 @@ class TemplateLayout extends \OC_Template {
// Send the language, locale, and direction to our layouts
$lang = \OC::$server->get(IFactory::class)->findLanguage();
$locale = \OC::$server->get(IFactory::class)->findLocale($lang);
- $direction = \OC::$server->getL10NFactory()->getLanguageDirectionFromLocale($locale);
+ $direction = \OC::$server->getL10NFactory()->getLanguageDirection($lang);
$lang = str_replace('_', '-', $lang);
$this->assign('language', $lang);
diff --git a/lib/public/L10N/IFactory.php b/lib/public/L10N/IFactory.php
index 4259baa3b2f..aebd318dfad 100644
--- a/lib/public/L10N/IFactory.php
+++ b/lib/public/L10N/IFactory.php
@@ -104,13 +104,13 @@ interface IFactory {
public function localeExists($locale);
/**
- * Return the current language direction from locale
+ * Return the language direction
*
- * @param string $locale
+ * @param string $language
* @return 'ltr'|'rtl'
* @since 31.0.0
*/
- public function getLanguageDirectionFromLocale(string $locale): string;
+ public function getLanguageDirection(string $language): string;
/**
* iterate through language settings (if provided) in this order: