mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-03 20:02:29 +02:00
Port of the RTL slice of Rosmi720/XC_VM@f34b4808. When the active language is right-to-left (ar/fa/ur/he), the admin and reseller shells and the login page render mirrored: - Translator::isRtl() reports whether a language (or the current one) is RTL. - admin/reseller headers and login set <html dir="rtl"> and load the Cairo web font + assets/xcvm/rtl.css only for RTL languages (a no-op for LTR). - rtl.css mirrors navigation, cards, tables and forms. - Arabic language file (ar.ini) so an RTL language is actually selectable. Adapted to this tree: only the language-driven RTL was taken (not the fork's navbar language switcher or the per-user RTL toggle); isRtl is unit-tested.
27 lines
831 B
PHP
27 lines
831 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use XcVm\Core\Localization\Translator;
|
|
|
|
/**
|
|
* Coverage for Translator::isRtl — decides whether the current (or a given)
|
|
* language is right-to-left, which drives the `dir` attribute and rtl.css load.
|
|
*/
|
|
final class TranslatorIsRtlTest extends TestCase {
|
|
|
|
public function testRtlLanguagesAreDetected(): void {
|
|
$this->assertTrue(Translator::isRtl('ar'));
|
|
$this->assertTrue(Translator::isRtl('FA'));
|
|
}
|
|
|
|
public function testLtrLanguagesAreNot(): void {
|
|
$this->assertFalse(Translator::isRtl('en'));
|
|
$this->assertFalse(Translator::isRtl('ru'));
|
|
}
|
|
|
|
public function testNullFallsBackToCurrentLanguage(): void {
|
|
// Whatever the current language is, the null form must equal the explicit one.
|
|
$this->assertSame(Translator::isRtl(Translator::current()), Translator::isRtl());
|
|
}
|
|
}
|