Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
Replace the boolean isRtl() with a direction() accessor on ContentLanguage
Paulo Castellanoc9209cb2a9f1
diff --git a/app/Enums/Workspace/ContentLanguage.php b/app/Enums/Workspace/ContentLanguage.phpindex 9448dc34a..ecb7f3e24 100644--- a/app/Enums/Workspace/ContentLanguage.php+++ b/app/Enums/Workspace/ContentLanguage.php@@ -12,7 +12,7 @@ namespace App\Enums\Workspace;** The string value is the language code stored on the workspace and passed* straight to the content prompts (`content_language`); the same codes also back- * the application's UI locales, so `isRtl()` drives the document `dir` attribute.+ * the application's UI locales, so `direction()` drives the document `dir` attribute.*/enum ContentLanguage: string{@@ -84,12 +84,12 @@ enum ContentLanguage: string}/**- * Whether the language is written right-to-left, which drives the `dir`- * attribute on the document root so the whole UI mirrors for the locale.+ * The text direction (`ltr` or `rtl`) for the document root when this is the+ * active UI locale — only Arabic is written right to left.*/- public function isRtl(): bool+ public function direction(): string{- return $this === self::Arabic;+ return $this === self::Arabic ? 'rtl' : 'ltr';}/**diff --git a/app/Http/Middleware/App/SetLocale.php b/app/Http/Middleware/App/SetLocale.phpindex 49a30cde4..a28cad1eb 100644--- a/app/Http/Middleware/App/SetLocale.php+++ b/app/Http/Middleware/App/SetLocale.php@@ -22,9 +22,10 @@ class SetLocale$locale = $request->cookie('locale');$isValid = $locale && array_key_exists($locale, $available);$activeLocale = $isValid ? $locale : config('languages.default');+ $language = ContentLanguage::tryFrom($activeLocale) ?? ContentLanguage::DEFAULT;App::setLocale($activeLocale);- View::share('htmlDir', ContentLanguage::tryFrom($activeLocale)?->isRtl() ? 'rtl' : 'ltr');+ View::share('htmlDir', $language->direction());$response = $next($request);diff --git a/tests/Unit/Enums/Workspace/ContentLanguageTest.php b/tests/Unit/Enums/Workspace/ContentLanguageTest.phpindex 88f8aa2e8..b816c52e7 100644--- a/tests/Unit/Enums/Workspace/ContentLanguageTest.php+++ b/tests/Unit/Enums/Workspace/ContentLanguageTest.php@@ -71,12 +71,12 @@ test('label returns the native name for every language', function (ContentLangua[ContentLanguage::Arabic, 'العربية'],]);-test('isRtl is true only for Arabic', function () {- expect(ContentLanguage::Arabic->isRtl())->toBeTrue();+test('direction is rtl only for Arabic', function () {+ expect(ContentLanguage::Arabic->direction())->toBe('rtl');foreach (ContentLanguage::cases() as $language) {if ($language !== ContentLanguage::Arabic) {- expect($language->isRtl())->toBeFalse();+ expect($language->direction())->toBe('ltr');}}});