Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion com.woltlab.wcf/templates/documentHeader.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html
dir="{lang}wcf.global.pageDirection{/lang}"
dir="ltr"
lang="{$__wcf->language->getBcp47()}"
data-color-scheme="{$__wcf->getStyleHandler()->getColorScheme()}"
>
3 changes: 2 additions & 1 deletion ts/WoltLabSuite/Core/Component/MainMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ function isOverflowing(): boolean {

// The toggles overlap the edge of their item, therefore the items are measured
// instead of relying on the scroll width of the menu. Both edges are checked
// because the items overflow to the left in RTL.
// because a style may center or right-align the items, which then overflow
// to the left as well.
return Array.from(menu.children).some((item) => {
if ((item as HTMLElement).hidden) {
return false;
Expand Down
11 changes: 4 additions & 7 deletions ts/WoltLabSuite/Core/Component/Media/Gallery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function getStep(track: HTMLElement, slides: HTMLElement[]): number {
return track.clientWidth;
}

return Math.abs(slides[1].offsetLeft - slides[0].offsetLeft);
return slides[1].offsetLeft - slides[0].offsetLeft;
}

function initGallery(gallery: HTMLElement): void {
Expand All @@ -28,17 +28,14 @@ function initGallery(gallery: HTMLElement): void {
const counter = controls.querySelector<HTMLElement>(".mediaGallery__counter")!;
const slides = Array.from(track.querySelectorAll<HTMLElement>(".mediaGallery__slide"));

// The scroll position is negative for right-to-left languages.
const isRtl = () => window.getComputedStyle(track).direction === "rtl";

const update = () => {
const isScrollable = track.scrollWidth > track.clientWidth + 1;
controls.hidden = !isScrollable;
if (!isScrollable) {
return;
}

const scrollPosition = Math.abs(track.scrollLeft);
const scrollPosition = track.scrollLeft;
const index = Math.min(Math.round(scrollPosition / getStep(track, slides)), slides.length - 1);

counter.textContent = `${index + 1} / ${slides.length}`;
Expand All @@ -50,8 +47,8 @@ function initGallery(gallery: HTMLElement): void {
track.scrollBy({ left: count * getStep(track, slides) });
};

previousButton.addEventListener("click", () => scrollBySlides(isRtl() ? 1 : -1));
nextButton.addEventListener("click", () => scrollBySlides(isRtl() ? -1 : 1));
previousButton.addEventListener("click", () => scrollBySlides(-1));
nextButton.addEventListener("click", () => scrollBySlides(1));

track.addEventListener("keydown", (event) => {
if (event.target !== track) {
Expand Down
5 changes: 2 additions & 3 deletions ts/WoltLabSuite/Core/Component/UserMenuDrawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,14 @@ function keydown(event: KeyboardEvent, tab: Tab): void {
const index = tabs.indexOf(tab);
const previous = index === 0 ? tabs.length - 1 : index - 1;
const next = index === tabs.length - 1 ? 0 : index + 1;
const isRtl = document.documentElement.dir === "rtl";

let target: number;
switch (event.key) {
case "ArrowLeft":
target = isRtl ? next : previous;
target = previous;
break;
case "ArrowRight":
target = isRtl ? previous : next;
target = next;
break;
case "Home":
target = 0;
Expand Down
6 changes: 0 additions & 6 deletions ts/WoltLabSuite/Core/Ui/Alignment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import * as Core from "../Core";
import * as DomTraverse from "../Dom/Traverse";
import DomUtil from "../Dom/Util";
import { getPhrase } from "WoltLabSuite/Core/Language";
import * as Environment from "../Environment";

type HorizontalAlignment = "center" | "left" | "right";
Expand Down Expand Up @@ -232,11 +231,6 @@ export function set(element: HTMLElement, referenceElement: HTMLElement, options
}
}

// in rtl languages we simply swap the value for 'horizontal'
if (getPhrase("wcf.global.pageDirection") === "rtl") {
options.horizontal = options.horizontal === "left" ? "right" : "left";
}

if (horizontal === null || !horizontal.result) {
const horizontalCenter = horizontal;
horizontal = tryAlignmentHorizontal(options.horizontal!, elDimensions, refDimensions, refOffsets, windowWidth);
Expand Down
21 changes: 0 additions & 21 deletions wcfsetup/install/files/acp/style/acpStyleEditor.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
html[dir="ltr"] #spWindow {
margin-right: 40px;
}
html[dir="rtl"] #spWindow {
margin-left: 40px;
}
#spSidebar {
flex: 0 0 300px;
}
Expand Down Expand Up @@ -89,9 +86,6 @@ html[dir="rtl"] #spWindow {
html[dir="ltr"] #spHeaderPanel ol.inlineList > li {
margin-right: 0;
}
html[dir="rtl"] #spHeaderPanel ol.inlineList > li {
margin-left: 0;
}
#spHeaderPanel ol.inlineList > li > a {
align-items: center;
background-color: var(--wcfHeaderMenuLinkBackground);
Expand All @@ -105,9 +99,6 @@ html[dir="rtl"] #spHeaderPanel ol.inlineList > li {
html[dir="ltr"] #spHeaderPanel ol.inlineList > li.active > a::after {
margin-left: 5px;
}
html[dir="rtl"] #spHeaderPanel ol.inlineList > li.active > a::after {
margin-right: 5px;
}
#spHeaderPanel ol.inlineList > li.active > a,
#spHeaderPanel ol.inlineList > li:hover > a {
background-color: var(--wcfHeaderMenuLinkBackgroundActive);
Expand Down Expand Up @@ -313,9 +304,6 @@ html[dir="rtl"] #spHeaderPanel ol.inlineList > li.active > a::after {
html[dir="ltr"] #spNavigation li:first-child::after {
margin-left: 5px;
}
html[dir="rtl"] #spNavigation li:first-child::after {
margin-right: 5px;
}

/* ### navigation (new page header layouts) ### */
#spWindow:not([data-page-header-layout="classic"]) #spNavigation {
Expand All @@ -341,9 +329,6 @@ html[dir="rtl"] #spNavigation li:first-child::after {
center / contain no-repeat;
width: 12px;
}
html[dir="rtl"] #spWindow:not([data-page-header-layout="classic"]) #spNavigation li:first-child::after {
transform: scaleX(-1);
}
#spWindow:not([data-page-header-layout="classic"]) #spContent {
padding-top: 10px;
}
Expand Down Expand Up @@ -416,9 +401,6 @@ html[dir="rtl"] #spWindow:not([data-page-header-layout="classic"]) #spNavigation
html[dir="ltr"] #spTable th {
text-align: left;
}
html[dir="rtl"] #spTable th {
text-align: right;
}
#spTable th,
#spTable td {
padding: 10px;
Expand Down Expand Up @@ -872,9 +854,6 @@ html[dir="rtl"] #spTable th {
html[dir="ltr"] #spContentSidebar {
margin-left: 20px;
}
html[dir="rtl"] #spContentSidebar {
margin-right: 20px;
}
#spContentSidebar .spContentSidebarBox {
padding: 20px;
background-color: var(--wcfSidebarBackground);
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/install/files/acp/templates/header.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<html
dir="{$__wcf->getLanguage()->getPageDirection()}"
dir="ltr"
lang="{$__wcf->getLanguage()->getBcp47()}"
data-color-scheme="{$__wcf->getStyleHandler()->getColorScheme()}"
>
Expand Down
2 changes: 1 addition & 1 deletion wcfsetup/install/files/acp/templates/rescueMode.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html dir="{$__wcf->getLanguage()->getPageDirection()}" lang="{$__wcf->getLanguage()->getFixedLanguageCode()}">
<html dir="ltr" lang="{$__wcf->getLanguage()->getFixedLanguageCode()}">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex">
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Alignment.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,6 @@ public function save()
if (\file_exists($this->styleTestFileDir . '/style.css')) {
\unlink($this->styleTestFileDir . '/style.css');
}
if (\file_exists($this->styleTestFileDir . '/style-rtl.css')) {
\unlink($this->styleTestFileDir . '/style-rtl.css');
}
if (\file_exists($this->styleTestFileDir . '/style-preload.json')) {
\unlink($this->styleTestFileDir . '/style-preload.json');
}
Expand Down
2 changes: 0 additions & 2 deletions wcfsetup/install/files/lib/acp/form/StyleEditForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,9 @@ public function save()
if (
$this->styleTestFileDir !== null
&& \file_exists($this->styleTestFileDir . '/style.css')
&& \file_exists($this->styleTestFileDir . '/style-rtl.css')
) {
$styleFilename = StyleCompiler::getFilenameForStyle($this->style);
\rename($this->styleTestFileDir . '/style.css', $styleFilename . '.css');
\rename($this->styleTestFileDir . '/style-rtl.css', $styleFilename . '-rtl.css');
if (\file_exists($this->styleTestFileDir . '/style-preload.json')) {
\rename($this->styleTestFileDir . '/style-preload.json', $styleFilename . '-preload.json');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,9 @@ public function save()
$defaultStyle !== null
&& $this->styleTestFileDir !== null
&& \file_exists($this->styleTestFileDir . '/style.css')
&& \file_exists($this->styleTestFileDir . '/style-rtl.css')
) {
$styleFilename = StyleCompiler::getFilenameForStyle($defaultStyle);
\rename($this->styleTestFileDir . '/style.css', $styleFilename . '.css');
\rename($this->styleTestFileDir . '/style-rtl.css', $styleFilename . '-rtl.css');
if (\file_exists($this->styleTestFileDir . '/style-preload.json')) {
\rename($this->styleTestFileDir . '/style-preload.json', $styleFilename . '-preload.json');
}
Expand Down
9 changes: 8 additions & 1 deletion wcfsetup/install/files/lib/data/language/Language.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ public function getFixedLanguageCode(): string

/**
* Returns the page direction of this language.
*
* @deprecated 6.3 Right-to-left languages are no longer supported, the page direction is always `ltr`.
*/
public function getPageDirection(): string
{
return $this->get('wcf.global.pageDirection');
return 'ltr';
}

/**
Expand Down Expand Up @@ -238,6 +240,11 @@ protected function loadCategory(string $category): bool
// include language file
@include_once($filename);

if ($category === 'wcf.global') {
// RTL is no longer supported, this overrides language packs that still ship `rtl`.
$this->items['wcf.global.pageDirection'] = 'ltr';
}

return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace wcf\system\form\builder\field;

use wcf\system\form\builder\field\validation\FormFieldValidationError;
use wcf\system\WCF;

/**
* Implementation of a form field to set the rating of an object.
Expand Down Expand Up @@ -59,10 +58,6 @@ public function __construct()
*/
public function getRatings(): array
{
if (WCF::getLanguage()->get('wcf.global.pageDirection') === 'rtl') {
return \range($this->maximum, $this->minimum, -1);
}

return \range($this->minimum, $this->maximum);
}

Expand Down
25 changes: 0 additions & 25 deletions wcfsetup/install/files/lib/system/style/StyleCompiler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use wcf\system\WCF;
use wcf\util\FileUtil;
use wcf\util\StringUtil;
use wcf\util\StyleUtil;
use wcf\util\Url;

/**
Expand Down Expand Up @@ -775,27 +774,6 @@ private function compileStylesheet(string $scss, array $variables): string
}
}

/**
* Converts the given CSS into the RTL variant.
*
* This method differs from StyleUtil::convertCSSToRTL() in that it includes some fixes
* for elements that need to remain LTR.
*
* @see StyleUtil::convertCSSToRTL()
*/
private function convertToRtl(string $css): string
{
$css = StyleUtil::convertCSSToRTL($css);

// force code boxes to be always LTR
$css .= "\n/* RTL fix for code boxes */\n";
$css .= ".codeBoxCode { direction: ltr; } \n";
$css .= ".codeBox .codeBoxCode { padding-left: 7ch; padding-right: 0; } \n";
$css .= ".codeBox .codeBoxCode > code .codeBoxLine > a { margin-left: -7ch; margin-right: 0; text-align: right; } \n";

return $css;
}

/**
* Writes the given css into the file with the given prefix.
*
Expand All @@ -806,9 +784,6 @@ private function writeCss(string $filePrefix, string $css, ?array $preloadManife
\file_put_contents($filePrefix . '.css', $css);
FileUtil::makeWritable($filePrefix . '.css');

\file_put_contents($filePrefix . '-rtl.css', $this->convertToRtl($css));
FileUtil::makeWritable($filePrefix . '-rtl.css');

if ($preloadManifest !== null) {
\file_put_contents($filePrefix . '-preload.json', \json_encode($preloadManifest, \JSON_THROW_ON_ERROR));
FileUtil::makeWritable($filePrefix . '-preload.json');
Expand Down
Loading
Loading