From 447dd3082b755070261c6512b1e257cc2defd213 Mon Sep 17 00:00:00 2001 From: A1Gard Date: Tue, 6 Feb 2024 07:14:50 +0330 Subject: [PATCH] added translator to setting WIP: setting titles --- app/Models/Setting.php | 5 +- config/translator.php | 2 +- database/seeders/SettingSeeder.php | 43 +++ resources/lang/fr.json | 490 ++++++++++++++++++++++++ resources/views/admin/setting.blade.php | 18 + 5 files changed, 556 insertions(+), 2 deletions(-) create mode 100644 resources/lang/fr.json diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 5e9d44e..00ddd5f 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -4,6 +4,7 @@ namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Spatie\Translatable\HasTranslations; /** * App\Models\Setting @@ -33,5 +34,7 @@ use Illuminate\Database\Eloquent\Model; */ class Setting extends Model { - use HasFactory; + use HasFactory,HasTranslations; + + public $translatable = ['value']; } diff --git a/config/translator.php b/config/translator.php index 119b19f..a7e16cf 100755 --- a/config/translator.php +++ b/config/translator.php @@ -4,7 +4,7 @@ use Translator\Framework\LaravelConfigLoader; use Translator\Infra\LaravelJsonTranslationRepository; return [ - 'languages' => ["fa","ru","ar","fr"], + 'languages' => ["fa","ru"], 'directories' => [ app_path(), resource_path('views'), diff --git a/database/seeders/SettingSeeder.php b/database/seeders/SettingSeeder.php index 11c1df2..eb94f08 100644 --- a/database/seeders/SettingSeeder.php +++ b/database/seeders/SettingSeeder.php @@ -14,6 +14,48 @@ class SettingSeeder extends Seeder */ public function run() { + + if (config('app.xlang')){ + $lang = config('app.xlang_main'); + \DB::insert(<<"}', '2022-08-02 00:40:14', '2024-02-06 03:14:33'), + (NULL, '6footer', 'text', 'شبکه اجتماعی ایستاگرام', 1, 'soc_in', '{"$lang":null}', '2022-08-02 00:41:20', '2024-02-06 03:14:33'), + (NULL, '6footer', 'text', 'شبکه اجتماعی تلگرام', 1, 'soc_tg', '{"$lang":null}', '2022-08-02 00:41:20', '2024-02-06 03:14:33'), + (NULL, '6footer', 'text', 'شبکه اجتماعی توییتر', 1, 'soc_tw', '{"$lang":"https:\\/\\/twitter.com\\/a1gard"}', '2022-08-02 00:41:20', '2024-02-06 03:14:33'), + (NULL, '6footer', 'text', 'شبکه اجتماعی واستاپ (شماره با کد کشور)', 1, 'soc_wp', '{"$lang":"+989121234567"}', '2022-08-02 00:41:20', '2024-02-06 03:14:33'), + (NULL, '6footer', 'text', 'شبکه اجتماعی یوتویب', 1, 'soc_yt', '{"$lang":null}', '2022-08-02 00:41:20', '2024-02-06 03:14:33'), + (NULL, '6footer', 'text', 'عنوان فوتر', 1, 'footer_title', '{"$lang":"\\u0627\\u0637\\u0644\\u0627\\u0639\\u0627\\u062a \\u062a\\u0645\\u0627\\u0633"}', '2022-08-02 00:41:20', '2024-02-06 03:14:33'), + (NULL, '6footer', 'editor', 'نوشته فوتر', 1, 'footer_text', '{"$lang":"

\\u0627\\u0641\\u0631\\u0627\\u062f \\u06af\\u0631\\u0648\\u0647 \\u0633\\u0648\\u0645 \\u0627\\u0632 \\u0627\\u0647\\u0645\\u06cc\\u062a \\u0628\\u0647 \\u067e\\u0627\\u06cc\\u0627\\u0646 \\u0631\\u0633\\u0627\\u0646\\u062f\\u0646 \\u0622\\u06af\\u0627\\u0647 \\u0647\\u0633\\u062a\\u0646\\u062f. \\u0622\\u0646\\u0647\\u0627 \\u0628\\u0627 \\u062a\\u0641\\u06a9\\u0631 \\u0645\\u0646\\u0637\\u0642\\u06cc\\u060c \\u0637\\u0631\\u062d\\u06cc \\u0631\\u0648\\u0634\\u0646 \\u0627\\u0631\\u0627\\u0626\\u0647 \\u0645\\u06cc‌\\u06a9\\u0646\\u0646\\u062f. \\u0622\\u0646\\u0647\\u0627 \\u0646\\u0647 \\u062a\\u0646\\u0647\\u0627 \\u0628\\u0631\\u0627\\u06cc \\u067e\\u0627\\u06cc\\u0627\\u0646 \\u062f\\u0627\\u062f\\u0646 \\u0628\\u0647 \\u067e\\u0631\\u0648\\u0698\\u0647‌\\u06cc \\u062e\\u0648\\u062f \\u062f\\u0631 \\u0622\\u06cc\\u0646\\u062f\\u0647 \\u0628\\u0631\\u0646\\u0627\\u0645\\u0647 \\u0631\\u06cc\\u0632\\u06cc \\u0645\\u06cc‌\\u06a9\\u0646\\u0646\\u062f\\u060c \\u0628\\u0644\\u06a9\\u0647 \\u0628\\u0647 \\u062a\\u0645\\u0627\\u0645 \\u0646\\u062a\\u0627\\u06cc\\u062c \\u0648 \\u0639\\u0648\\u0627\\u0642\\u0628 \\u0627\\u062c\\u0631\\u0627\\u06cc \\u0622\\u0646 \\u0628\\u0631\\u0646\\u0627\\u0645\\u0647 \\u0647\\u0645 \\u0645\\u06cc‌\\u0627\\u0646\\u062f\\u06cc\\u0634\\u0646\\u062f. \\u0627\\u06cc\\u0646 \\u0627\\u0641\\u0631\\u0627\\u062f \\u06a9\\u0633\\u0627\\u0646\\u06cc \\u0647\\u0633\\u062a\\u0646\\u062f \\u06a9\\u0647 \\u0647\\u0646\\u0631 \\u0628\\u0647 \\u067e\\u0627\\u06cc\\u0627\\u0646 \\u0631\\u0633\\u0627\\u0646\\u062f\\u0646 \\u0631\\u0627 \\u0645\\u06cc‌\\u062f\\u0627\\u0646\\u0646\\u062f.<\\/p>"}', '2022-08-02 00:41:20', '2024-02-06 03:14:33'), + (NULL, '7seo', 'text', 'کد رنگ سایت', 1, 'color', '{"$lang":"#3593D2"}', '2022-08-02 00:48:38', '2024-02-06 03:14:33'), + (NULL, '7seo', 'text', 'سئو کلمات کلیدی', 1, 'keywords', '{"$lang":"\\u0641\\u0631\\u0648\\u0634\\u06af\\u0627\\u0647\\u060c \\u0641\\u0631\\u0648\\u0634 \\u0622\\u0646\\u0644\\u0627\\u06cc\\u0646"}', '2022-08-02 00:49:10', '2024-02-06 03:14:33'), + (NULL, '7seo', 'text', 'سئو جزئیات', 1, 'desc', '{"$lang":"\\u062a\\u0648\\u0636\\u06cc\\u062d\\u0627\\u062a \\u0641\\u0631\\u0648\\u0634\\u06af\\u0627\\u0647 \\u0634\\u0645\\u0627"}', '2022-08-02 00:50:08', '2024-02-06 03:14:33'), + (NULL, '7seo', 'text', 'متن کپی رایت', 1, 'copyright', '{"$lang":"\\u06a9\\u0644\\u06cc\\u0647 \\u062d\\u0642\\u0648\\u0642 \\u0628\\u0631\\u0627\\u06cc \\u0648\\u0628\\u0633\\u0627\\u06cc\\u062a \\u0641\\u0631\\u0648\\u0634\\u06af\\u0627\\u0647 \\u0645\\u062d\\u0641\\u0648\\u0638 \\u0627\\u0633\\u062a"}', '2022-08-02 01:10:18', '2024-02-06 03:14:33'), + (NULL, '1menu', 'text', 'تلفن', 1, 'tel', '{"$lang":"021"}', '2023-02-22 20:51:33', '2024-02-06 03:14:33'), + (NULL, '1menu', 'text', 'ایمیل', 1, 'email', '{"$lang":"info@local"}', '2023-02-22 20:51:53', '2024-02-06 03:14:33'), + (NULL, 'seo', 'text', 'نام سایت', 1, 'site_name', '{"$lang":"\\u0641\\u0631\\u0648\\u0634\\u06af\\u0627\\u0647 \\u0627\\u06cc\\u06a9\\u0633 \\u0634\\u0627\\u067e"}', '2022-09-14 05:16:58', '2024-02-06 03:14:33'), + (NULL, 'seo', 'text', 'توضیح کوتاه سایت(SEO)', 1, 'site_description', '{"$lang":"\\u0628\\u0647 \\u0631\\u0648\\u0632\\u062a\\u0631\\u06cc\\u0646 \\u06af\\u0648\\u0634\\u06cc \\u0647\\u0627 \\u0628\\u0627 \\u06a9\\u0645\\u062a\\u0631\\u06cc\\u0646 \\u0642\\u06cc\\u0645\\u062a"}', '2022-09-14 05:18:23', '2024-02-06 03:14:33'), + (NULL, 'seo', 'text', 'کلمات کلیدی سایت (SEO- با کاما از هم جدا کنید)', 1, 'site_keywords', '{"$lang":"\\u06af\\u0648\\u0634\\u06cc\\u060c\\u0627\\u0631\\u0632\\u0627\\u0646\\u060c\\u062e\\u0631\\u06cc\\u062f\\u060c\\u0627\\u06cc\\u06a9\\u0633 \\u0634\\u0627\\u067e"}', '2022-09-14 05:22:56', '2024-02-06 03:14:33'), + (NULL, 'seo', 'text', 'کد گوگل وب مستر', 1, 'site_webmaster_google', '{"$lang":null}', '2022-09-14 05:29:17', '2024-02-06 03:14:33'), + (NULL, 'seo', 'image', 'تصویر سایت(SEO)', 1, 'site_image', NULL, '2022-09-14 05:30:51', '2022-09-14 05:30:51'); +SQL); + }else{ + // \DB::insert(<<action": "", + ":app Dear customer Your :product signed for you.": "", + "A fresh verification link has been sent to your email address.": "", + "AI translate form original source": "", + "API error!": "", + "Action": "", + "Actions": "", + "Active": "", + "Active now": "", + "Add": "", + "Add address": "", + "Add new setting": "", + "Add to setting": "", + "Added to card": "", + "Address": "", + "Address removed": "", + "Address saved": "", + "Addresses": "", + "Admin": "", + "Advanced information": "", + "Advertise": "", + "Advertise list": "", + "All": "", + "All posts": "", + "Alternative address": "", + "Amount": "", + "Answer": "", + "Application request": "", + "Approve": "", + "Approved": "", + "Are you sure to remove?": "", + "Attached": "", + "Attachment": "", + "Attachment removed": "", + "Attachments": "", + "Auth code error": "", + "Back order": "", + "Base price": "", + "Basic information": "", + "Before proceeding, please check your email for a verification link.": "", + "Belong to": "", + "Body": "", + "Bulk action": "", + "By percent": "", + "By price": "", + "CLOSED": "", + "Call us!": "", + "Canceled": "", + "Card cleared": "", + "Cat": "", + "Catalog": "", + "Categories": "", + "Categories deleted successfully": "", + "Categories list": "", + "Categories node": "", + "Category": "", + "Category Parent": "", + "Category name": "", + "Category with Sub Category": "", + "Category with sub posts": "", + "Check discount": "", + "Checkbox": "", + "Checkbox type": "", + "Choose a image to upload": "", + "Choose one": "", + "City": "", + "Click": "", + "Click here to upload or drag and drop here": "", + "Clip": "", + "Clip list": "", + "Clips": "", + "Code": "", + "Colleague": "", + "Color type": "", + "Comments": "", + "Compare products": "", + "Complete your purchase": "", + "Completed": "", + "Confirm Password": "", + "Contact list": "", + "Contact us": "", + "ContactUs": "", + "Contacts": "", + "Count": "", + "Cover": "", + "Create adv": "", + "Create clip": "", + "Create poll": "", + "Create slider": "", + "Create user": "", + "Created At": "", + "Credit": "", + "Credit applied": "", + "Customer": "", + "Customer created successfully": "", + "Customer deleted successfully": "", + "Customer profile": "", + "Customer updated successfully": "", + "Customers": "", + "Customers deleted successfully": "", + "Customers list": "", + "Dashboard": "", + "Date": "", + "Deactive": "", + "Dear customer, Please complete your information": "", + "Default": "", + "Delete": "", + "Description": "", + "Description Text": "", + "Direct link": "", + "Direction": "", + "Discount": "", + "Discount code": "", + "Discount code incorrect": "", + "Discount code accepted": "", + "Discounts": "", + "Discounts list": "", + "Do": "", + "Double click on image to change index image": "", + "Double click on to remove item": "", + "Download json file": "", + "Draft": "", + "Draft now": "", + "Drafted": "", + "E-Mail Address": "", + "Edit": "", + "Edit Discount": "", + "Edit Menu": "", + "Edit Post": "", + "Edit Product": "", + "Edit adv": "", + "Edit category": "", + "Edit clip": "", + "Edit customer": "", + "Edit discount": "", + "Edit invoice": "", + "Edit language": "", + "Edit poll": "", + "Edit product": "", + "Edit product category": "", + "Edit slider": "", + "Edit ticket": "", + "Edit transport": "", + "Edit user": "", + "Editor text": "", + "Email": "", + "Email Address": "", + "Empty title": "", + "Excerpt": "", + "Expire": "", + "Expire date": "", + "Expire date": "", + "Failed": "", + "False": "", + "Favorites": "", + "File": "", + "Filter": "", + "Finish and save": "", + "Flag": "", + "Forgot Your Password?": "", + "Free": "", + "Friday": "", + "From": "", + "Full name": "", + "Galleries": "", + "Galleries list": "", + "Gallery": "", + "Gallery list": "", + "Gram(s)": "", + "Hello": "", + "Icon": "", + "If you did not receive the email": "", + "If you have any description about your order write here...": "", + "Image": "", + "Images": "", + "In stock": "", + "Inactive now": "", + "Incorrect mobile number": "", + "Index image": "", + "Information": "", + "Invalid json file!": "", + "Invalid search": "", + "Invoice": "", + "Invoice id": "", + "Invoice payed.": "", + "Invoice status": "", + "Invoices": "", + "Invoices deleted successfully": "", + "Invoices list": "", + "Invoices status changed successfully": "", + "Is breaking news?": "", + "Is default": "", + "Is effective price?": "", + "Key": "", + "LTR": "", + "Label": "", + "Lang": "", + "Language list": "", + "Languages": "", + "Languages translate": "", + "Last update": "", + "Link": "", + "Login": "", + "Login \/ Register": "", + "Logout": "", + "Logs": "", + "Long text": "", + "Magazine": "", + "Main address": "", + "Main category": "", + "Main language content": "", + "Main product category": "", + "Manage": "", + "Max click": "", + "Menu": "", + "Menus": "", + "Menus list": "", + "Menus preview": "", + "Metas and publish": "", + "Mobile": "", + "Model": "", + "Monday": "", + "Multi select type": "", + "Name": "", + "Name and lastname": "", + "New Advertise": "", + "New Clip": "", + "New Customer": "", + "New Discount": "", + "New Gallery": "", + "New Invoice": "", + "New Poll": "", + "New Post": "", + "New Product": "", + "New Product category": "", + "New Property": "", + "New Slider": "", + "New Video": "", + "New category": "", + "New customer": "", + "New discount": "", + "New gallery": "", + "New invoice": "", + "New language": "", + "New menu": "", + "New product": "", + "New product category": "", + "New ticket": "", + "New transport": "", + "New user": "", + "Next": "", + "No": "", + "No parent": "", + "No product": "", + "Normal": "", + "Not required": "", + "Number type": "", + "Online": "", + "Option": "", + "Options": "", + "Order": "", + "Order type": "", + "Out stock": "", + "Page name": "", + "Parent": "", + "Password": "", + "Pay by credit": "", + "Payment Type": "", + "Payment error": "", + "Payment price:": "", + "Pediatric dental clips": "", + "Pending": "", + "Phone": "", + "Pictures": "", + "Pin": "", + "Please change payment gate.": "", + "Please confirm your password before continuing.": "", + "Poll": "", + "Poll list": "", + "Polls": "", + "Polls list": "", + "Post": "", + "Post Text": "", + "Post list": "", + "Post reply": "", + "Postal code": "", + "Posts": "", + "Posts search": "", + "Preview": "", + "Previous": "", + "Price": "", + "Price range": "", + "Print": "", + "Processing": "", + "Product": "", + "Product added to favorite": "", + "Product categories": "", + "Product categories list": "", + "Product categories node": "", + "Product category": "", + "Product category Parent": "", + "Product category created successfully": "", + "Product category deleted successfully": "", + "Product category name": "", + "Product category updated successfully": "", + "Product deleted successfully": "", + "Product invoice deleted successfully": "", + "Product invoice updated successfully": "", + "Product removed form card": "", + "Product removed from favorite": "", + "Product restore successfully": "", + "Product stock changed successfully": "", + "Products": "", + "Products list": "", + "Profile": "", + "Profile updated": "", + "Properties list": "", + "Properties meta": "", + "Properties sort": "", + "Props": "", + "Publish now": "", + "Published": "", + "Quantity": "", + "Question": "", + "Question \/ Answer": "", + "Question\/Message": "", + "Questions": "", + "RTL": "", + "Ref ID": "", + "Register": "", + "Register or login to complete purchase": "", + "Reject": "", + "Remember Me": "", + "Remove": "", + "Reply": "", + "Required": "", + "Reserve order for :H hours": "", + "Reset": "", + "Reset Password": "", + "Restore": "", + "Role": "", + "SKU": "", + "SMS Code": "", + "SMS send, Please login with you Auth code": "", + "Saturday": "", + "Save": "", + "Save sort": "", + "Search": "", + "Search for": "", + "Search in all panel": "", + "Searchable": "", + "Section": "", + "Select type": "", + "Send": "", + "Send Answer": "", + "Send Answer and close": "", + "Send Password Reset Link": "", + "Send new ticket": "", + "Setting": "", + "Setting added to website": "", + "Setting of website updated": "", + "Shopping card": "", + "Short text": "", + "Show": "", + "Signup or Login": "", + "Single Select & multi search": "", + "Slider": "", + "Slider list": "", + "Sliders": "", + "Sort": "", + "Sort category": "", + "Sort product category": "", + "Special quantity": "", + "State": "", + "Status": "", + "Stock quantity": "", + "Store": "", + "Sub invoices items": "", + "Subject": "", + "Subtitle": "", + "Sum": "", + "Sunday": "", + "Tag": "", + "Tag search": "", + "Tag with sub posts": "", + "Tagged by": "", + "Tags": "", + "Tax": "", + "Text": "", + "Text type": "", + "The first and\/or second image will be index image": "", + "The order is duplicate please check invoices list": "", + "Thumbnail": "", + "Thursday": "", + "Ticket answered successfully": "", + "Ticket has been sent": "", + "Tickets": "", + "Tickets deleted successfully": "", + "Tickets status changed successfully": "", + "Title": "", + "To": "", + "Toggle navigation": "", + "Total Price": "", + "Total amount": "", + "Tracking code": "", + "Translate model": "", + "Translate updated": "", + "Translate with AI": "", + "Translated by ai xstack service:": "", + "Translates": "", + "Transport": "", + "Transport method": "", + "Transport price": "", + "Transports": "", + "Transports list": "", + "Trashed": "", + "True": "", + "Try login": "", + "Tuesday": "", + "Type": "", + "Under construction": "", + "Unit": "", + "Unknown bulk action :": "", + "Upload file": "", + "Upload images": "", + "Upload new images": "", + "User": "", + "User list": "", + "Username": "", + "Users": "", + "Users list": "", + "Value": "", + "Verify Your Email Address": "", + "Video clip": "", + "Video clips": "", + "Video list": "", + "We call you about price soon.": "", + "Website contents": "", + "Wednesday": "", + "Welcome": "", + "Width": "", + "Yes": "", + "You are logged in!": "", + "You can choose one or more image together": "", + "You disliked ": "", + "You don't have any credit": "", + "You dont't have acccess this acction": "", + "You have got :count products in your basket, Could you complete your purchase?": "", + "You liked ": "", + "You liked ago ": "", + "You order reserved for a few hours, please pay to complete process": "", + "You voted ago ": "", + "You voted right now ": "", + "Your Email sent": "", + "Your authentication code": "", + "Your comment submited successfully, After approve will be visbile.": "", + "Your credit": "", + "Your invoices": "", + "Your message has been successfully sent.": "", + "Your message...": "", + "Your question has been sent, We answer it soon.": "", + "Your question or request...": "", + "action": "", + "body": "", + "by percent": "", + "by price": "", + "choose addrress": "", + "click here to request another": "", + "clip or cover not uploaded...": "", + "created successfully": "", + "deleted successfully": "", + "id": "", + "invoice created successfully": "", + "name \/ email": "", + "not searchable": "", + "password repeat": "", + "phone": "", + "postal_code": "", + "preview": "", + "reply": "", + "slider or cover not uploaded...": "", + "transports deleted successfully": "", + "updated successfully": "", + "weight": "" +} \ No newline at end of file diff --git a/resources/views/admin/setting.blade.php b/resources/views/admin/setting.blade.php index 106e678..49aef0f 100755 --- a/resources/views/admin/setting.blade.php +++ b/resources/views/admin/setting.blade.php @@ -22,6 +22,12 @@ @switch($set->type) @case('longtext') + @if(config('app.xlang')) + + + + @endif @break @@ -51,6 +57,12 @@ rows="5">{{$set->value}} @break @case('editor') + @if(config('app.xlang')) + + + + @endif @@ -79,6 +91,12 @@ class="form-control-file"/> @break @default + @if(config('app.xlang')) + + + + @endif @endswitch