From eb0ec6fb241a3a1c9f10a780ac58065431a64ab3 Mon Sep 17 00:00:00 2001 From: John Rallis Date: Tue, 30 Jun 2026 14:17:30 +0300 Subject: [PATCH] Add more content languages --- .../App/Workspace/StoreWorkspaceRequest.php | 2 +- .../App/Workspace/UpdateWorkspaceRequest.php | 2 +- app/Services/Brand/HomepageMetaExtractor.php | 12 ++++++++++ resources/js/components/BrandForm.vue | 24 +++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/App/Workspace/StoreWorkspaceRequest.php b/app/Http/Requests/App/Workspace/StoreWorkspaceRequest.php index 2a6711a8..59826bab 100644 --- a/app/Http/Requests/App/Workspace/StoreWorkspaceRequest.php +++ b/app/Http/Requests/App/Workspace/StoreWorkspaceRequest.php @@ -32,7 +32,7 @@ public function rules(): array 'text_color' => $hex, 'brand_font' => ['sometimes', 'string', Rule::in(BrandFont::values())], 'image_style' => ['sometimes', 'string', Rule::in(ImageStyle::values())], - 'content_language' => ['nullable', 'string', 'in:en,pt-BR,es'], + 'content_language' => ['nullable', 'string', 'in:en,pt-BR,es,fr,de,it,nl,pl,el,ja,ko,zh,ru,tr,ar'], 'logo_url' => ['nullable', 'url', 'max:1024'], ]; } diff --git a/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php b/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php index f2b6cc77..476e63ce 100644 --- a/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php +++ b/app/Http/Requests/App/Workspace/UpdateWorkspaceRequest.php @@ -32,7 +32,7 @@ public function rules(): array 'text_color' => $hex, 'brand_font' => ['sometimes', 'required', 'string', Rule::in(BrandFont::values())], 'image_style' => ['sometimes', 'required', 'string', Rule::in(ImageStyle::values())], - 'content_language' => ['sometimes', 'string', 'in:en,pt-BR,es'], + 'content_language' => ['sometimes', 'string', 'in:en,pt-BR,es,fr,de,it,nl,pl,el,ja,ko,zh,ru,tr,ar'], ]; } diff --git a/app/Services/Brand/HomepageMetaExtractor.php b/app/Services/Brand/HomepageMetaExtractor.php index 55d52c85..5291330e 100644 --- a/app/Services/Brand/HomepageMetaExtractor.php +++ b/app/Services/Brand/HomepageMetaExtractor.php @@ -297,6 +297,18 @@ private function extractLanguage(Crawler $crawler): ?string str_starts_with($lower, 'pt') => 'pt-BR', str_starts_with($lower, 'es') => 'es', str_starts_with($lower, 'en') => 'en', + str_starts_with($lower, 'fr') => 'fr', + str_starts_with($lower, 'de') => 'de', + str_starts_with($lower, 'it') => 'it', + str_starts_with($lower, 'nl') => 'nl', + str_starts_with($lower, 'pl') => 'pl', + str_starts_with($lower, 'el') => 'el', + str_starts_with($lower, 'ja') => 'ja', + str_starts_with($lower, 'ko') => 'ko', + str_starts_with($lower, 'zh') => 'zh', + str_starts_with($lower, 'ru') => 'ru', + str_starts_with($lower, 'tr') => 'tr', + str_starts_with($lower, 'ar') => 'ar', default => null, }; } diff --git a/resources/js/components/BrandForm.vue b/resources/js/components/BrandForm.vue index 0b82368f..a46a06d9 100644 --- a/resources/js/components/BrandForm.vue +++ b/resources/js/components/BrandForm.vue @@ -100,6 +100,18 @@ const languageLabel = computed(() => { en: 'English', 'pt-BR': 'Português (Brasil)', es: 'Español', + fr: 'Français', + de: 'Deutsch', + it: 'Italiano', + nl: 'Nederlandse', + pl: 'Polski', + el: 'Ελληνικά', + ja: '日本語', + ko: '한국어', + zh: '现代标准汉语', + ru: 'Русский', + tr: 'Türkçe', + ar: 'العربية', }; return map[props.fields.content_language] ?? ''; }); @@ -200,6 +212,18 @@ const runAutofill = async () => { English Português (Brasil) Español + Français + Deutsch + Italiano + Nederlandse + Polski + Ελληνικά + 日本語 + 한국어 + 现代标准汉语 + Русский + Türkçe + العربية