<head> <meta name="csrf-token" content="{{ csrftoken() }}"> <meta charset="UTF-8" />…
- User
<meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Sas Radius Pro Dashboard</title> <link rel="stylesheet" href="css/style.css" /> <!-- boostrap --> <link rel="stylesheet" href="css/bootstrap.css" /> <script src="js/bootstrap.js"></script> <!-- font awesome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" /><div class="content_page"> <div class="header"> <div class="left"> <div class="icon_menu"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" /> </svg> </div> <div class="logo_header"> <img src="images/logo.png" alt="logo" loading="lazy" /> </div> <div class="input_search"> <input type="text" placeholder="Search..." /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" /> </svg> </div> </div> <div class="right"> @include(view: 'include.translation') <div class="notfication"> <div class="head"> <div class="icon"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0M3.124 7.5A8.969 8.969 0 015.292 3m13.416 0a8.969 8.969 0 012.168 4.5" /> </svg> </div> </div> </div> <div class="nav_item"> <div class="head"> <img class="img_profile" src="images/user-1.jpg" alt="user-1" loading="lazy" /> </div> @include('include.profile') </div> </div> </div> <div class="main_content_tables"> <div class="conetnt_table"> <div class="path"> <span>الرئيسيه</span> / <span>الرسائل</span> </div> <div class="head_table"> <div class="info"> <p class="text_details"> <i class="fa-solid fa-people-group"></i> قائمة الرسائل | عثر على 4 قيد </p> </div> <div class="input_search"> <input type="text" placeholder="Search..." /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" ></path> </svg> </div> <div class="utils"> <div class="actions_box"> <button class="btn_actions"> <i class="fa-solid fa-wrench"></i> العمليات </button> <div class="box box_utils"> <a href={{route('msgadd')}} class="item"> <i class="fa-solid fa-plus"></i> <span>اضافه</span> </a> <button class="item" id="deletebtn"> <i class="fa-solid fa-trash"></i> <span> حذف</span> </button> <div class="item"> <i class="fa-solid fa-envelope"></i> <span>تغير الاسم</span> </div> </div> </div> <div class="reload"> <button class="btn_utils"> <i class="fa-solid fa-repeat"></i> </button> </div> </div> </div> <div class="container_table"> <table id="table" class="display" style="width: 100%"> <thead> <tr> <th> <input type="checkbox" /> </th> <th>الرساله</th> <th>من</th> <th>الي</th> <th>تاريخ الانشاء</th> </tr> </thead> <tbody> @foreach ($alldta as $dta) <tr> <td><input type="checkbox"></td> <td>{{$dta->message}}</td> <td>defaultPhone</td> <td>{{$dta->phone}}</td> <td>{{$dta->created_at}}</td> </tr>@endforeach
<!-- start model add group --> <div class="overflow"></div> <div class="model_poup" data-model="1"> <div class="content"> <div class="head"> <h5 class="title_model">المجموعات</h5> <div class="close_model"> <i class="fa-solid fa-xmark"></i> </div> </div> <form action=""> <div class="input_item"> <label for=""> اختر مجموعه</label> <select name="" id=""> <option value=""></option> <option value="">كل العملاء</option> </select> </div> <button class="btn_submit">موافق</button> </form> </div> </div> <div id="deleteConfirmationModal" class="custom-modal"><meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Sas Radius Pro Dashboard</title> <link rel="stylesheet" href="css/style.css" /> <!-- boostrap --> <link rel="stylesheet" href="css/bootstrap.css" /> <script src="js/bootstrap.js"></script> <!-- font awesome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" /><div class="content_page"> <div class="header"> <div class="left"> <div class="icon_menu"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" /> </svg> </div> <div class="logo_header"> <img src="images/logo.png" alt="logo" loading="lazy" /> </div> <div class="input_search"> <input type="text" placeholder="Search..." /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" /> </svg> </div> </div> <div class="right"> @include(view: 'include.translation') <div class="notfication"> <div class="head"> <div class="icon"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0M3.124 7.5A8.969 8.969 0 015.292 3m13.416 0a8.969 8.969 0 012.168 4.5" /> </svg> </div> </div> </div> <div class="nav_item"> <div class="head"> <img class="img_profile" src="images/user-1.jpg" alt="user-1" loading="lazy" /> </div> @include('include.profile') </div> </div> </div> <div class="main_content_tables"> <div class="conetnt_table"> <div class="path"> <span>الرئيسيه</span> / <span>الرسائل</span> </div> <div class="head_table"> <div class="info"> <p class="text_details"> <i class="fa-solid fa-people-group"></i> قائمة الرسائل | عثر على 4 قيد </p> </div> <div class="input_search"> <input type="text" placeholder="Search..." /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" ></path> </svg> </div> <div class="utils"> <div class="actions_box"> <button class="btn_actions"> <i class="fa-solid fa-wrench"></i> العمليات </button> <div class="box box_utils"> <a href={{route('msgadd')}} class="item"> <i class="fa-solid fa-plus"></i> <span>اضافه</span> </a> <button class="item" id="deletebtn"> <i class="fa-solid fa-trash"></i> <span> حذف</span> </button> <div class="item"> <i class="fa-solid fa-envelope"></i> <span>تغير الاسم</span> </div> </div> </div> <div class="reload"> <button class="btn_utils"> <i class="fa-solid fa-repeat"></i> </button> </div> </div> </div> <div class="container_table"> <table id="table" class="display" style="width: 100%"> <thead> <tr> <th> <input type="checkbox" /> </th> <th>الرساله</th> <th>من</th> <th>الي</th> <th>تاريخ الانشاء</th> </tr> </thead> <tbody> @foreach ($alldta as $dta) <tr> <td><input type="checkbox"></td> <td>{{$dta->message}}</td> <td>defaultPhone</td> <td>{{$dta->phone}}</td> <td>{{$dta->created_at}}</td> </tr>@endforeach
<!-- start model add group --> <div class="overflow"></div> <div class="model_poup" data-model="1"> <div class="content"> <div class="head"> <h5 class="title_model">المجموعات</h5> <div class="close_model"> <i class="fa-solid fa-xmark"></i> </div> </div> <form action=""> <div class="input_item"> <label for=""> اختر مجموعه</label> <select name="" id=""> <option value=""></option> <option value="">كل العملاء</option> </select> </div> <button class="btn_submit">موافق</button> </form> </div> </div> <div id="deleteConfirmationModal" class="custom-modal"><meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Sas Radius Pro Dashboard</title> <link rel="stylesheet" href="css/style.css" /> <!-- boostrap --> <link rel="stylesheet" href="css/bootstrap.css" /> <script src="js/bootstrap.js"></script> <!-- font awesome --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-iecdLmaskl7CVkqkXNQ/ZH/XLlvWZOJyj7Yy7tcenmpD1ypASozpmT/E0iPtmFIB46ZmdtAc9eNBvH0H/ZpiBw==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" /><div class="content_page"> <div class="header"> <div class="left"> <div class="icon_menu"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" /> </svg> </div> <div class="logo_header"> <img src="images/logo.png" alt="logo" loading="lazy" /> </div> <div class="input_search"> <input type="text" placeholder="Search..." /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" /> </svg> </div> </div> <div class="right"> @include(view: 'include.translation') <div class="notfication"> <div class="head"> <div class="icon"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M14.857 17.082a23.848 23.848 0 005.454-1.31A8.967 8.967 0 0118 9.75v-.7V9A6 6 0 006 9v.75a8.967 8.967 0 01-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 01-5.714 0m5.714 0a3 3 0 11-5.714 0M3.124 7.5A8.969 8.969 0 015.292 3m13.416 0a8.969 8.969 0 012.168 4.5" /> </svg> </div> </div> </div> <div class="nav_item"> <div class="head"> <img class="img_profile" src="images/user-1.jpg" alt="user-1" loading="lazy" /> </div> @include('include.profile') </div> </div> </div> <div class="main_content_tables"> <div class="conetnt_table"> <div class="path"> <span>الرئيسيه</span> / <span>الرسائل</span> </div> <div class="head_table"> <div class="info"> <p class="text_details"> <i class="fa-solid fa-people-group"></i> قائمة الرسائل | عثر على 4 قيد </p> </div> <div class="input_search"> <input type="text" placeholder="Search..." /> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6" > <path stroke-linecap="round" stroke-linejoin="round" d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z" ></path> </svg> </div> <div class="utils"> <div class="actions_box"> <button class="btn_actions"> <i class="fa-solid fa-wrench"></i> العمليات </button> <div class="box box_utils"> <a href={{route('msgadd')}} class="item"> <i class="fa-solid fa-plus"></i> <span>اضافه</span> </a> <button class="item" id="deletebtn"> <i class="fa-solid fa-trash"></i> <span> حذف</span> </button> <div class="item"> <i class="fa-solid fa-envelope"></i> <span>تغير الاسم</span> </div> </div> </div> <div class="reload"> <button class="btn_utils"> <i class="fa-solid fa-repeat"></i> </button> </div> </div> </div> <div class="container_table"> <table id="table" class="display" style="width: 100%"> <thead> <tr> <th> <input type="checkbox" /> </th> <th>الرساله</th> <th>من</th> <th>الي</th> <th>تاريخ الانشاء</th> </tr> </thead> <tbody> @foreach ($alldta as $dta) <tr> <td><input type="checkbox"></td> <td>{{$dta->message}}</td> <td>defaultPhone</td> <td>{{$dta->phone}}</td> <td>{{$dta->created_at}}</td> </tr>@endforeach
<!-- start model add group --> <div class="overflow"></div> <div class="model_poup" data-model="1"> <div class="content"> <div class="head"> <h5 class="title_model">المجموعات</h5> <div class="close_model"> <i class="fa-solid fa-xmark"></i> </div> </div> <form action=""> <div class="input_item"> <label for=""> اختر مجموعه</label> <select name="" id=""> <option value=""></option> <option value="">كل العملاء</option> </select> </div> <button class="btn_submit">موافق</button> </form> </div> </div> <div id="deleteConfirmationModal" class="custom-modal"> - Assistant
Certainly! Below are the
ar.jsonanden.jsonfiles with all the hardcoded strings from your HTML template replaced with translation keys. This will allow you to manage translations effectively in your Laravel application.
en.json{ "Sas Radius Pro Dashboard": "Sas Radius Pro Dashboard", "Home": "Home", "Messages": "Messages", "Message List | Found :count entries": "Message List | Found :count entries", "Add": "Add", "Delete": "Delete", "Change Name": "Change Name", "Groups": "Groups", "Choose Group": "Choose Group", "All Clients": "All Clients", "Confirm": "Confirm", "Delete Confirmation": "Delete Confirmation", "Are you sure you want to delete these messages?": "Are you sure you want to delete these messages?", "Cancel": "Cancel", "Operations": "Operations", "From": "From", "To": "To", "Message": "Message", "Creation Date": "Creation Date", "Search...": "Search..." }
ar.json{ "Sas Radius Pro Dashboard": "Sas Radius Pro Dashboard", "Home": "الرئيسيه", "Messages": "الرسائل", "Message List | Found :count entries": "قائمة الرسائل | عثر على :count قيد", "Add": "اضافه", "Delete": "حذف", "Change Name": "تغير الاسم", "Groups": "المجموعات", "Choose Group": "اختر مجموعه", "All Clients": "كل العملاء", "Confirm": "موافق", "Delete Confirmation": "تأكيد الحذف", "Are you sure you want to delete these messages?": "هل أنت متأكد من حذف هذه الرسائل؟", "Cancel": "الغاء", "Operations": "العمليات", "From": "من", "To": "الي", "Message": "الرساله", "Creation Date": "تاريخ الانشاء", "Search...": "بحث..." }
Implementation Steps
To integrate these translation files into your Laravel application and replace the hardcoded strings, follow these steps:
-
Place Translation Files:
- Save the
en.jsonfile in theresources/lang/en/directory. - Save the
ar.jsonfile in theresources/lang/ar/directory.
- Save the
-
Set Up Localization:
- Ensure that your
config/app.phpfile has the following settings:'locale' => 'en', 'fallback_locale' => 'en', - To support Arabic, you might want to allow users to switch locales. This can be handled via middleware or controller logic.
- Ensure that your
-
Update Blade Templates:
- Replace all hardcoded strings with the
__helper function or@langdirective. - Example:
<!-- Before --> <button class="btn_actions"> <i class="fa-solid fa-wrench"></i> العمليات </button> <!-- After --> <button class="btn_actions"> <i class="fa-solid fa-wrench"></i> {{ __('Operations') }} </button> - For Attributes and Placeholders:
<!-- Before --> <input type="text" placeholder="Search..." /> <!-- After --> <input type="text" placeholder="{{ __('Search...') }}" />
- Replace all hardcoded strings with the
-
Handling Dynamic Content:
- For strings that include dynamic data, use placeholders.
- Example:
<!-- In Blade Template --> <p class="text_details"> <i class="fa-solid fa-people-group"></i> {{ __('Message List | Found :count entries', ['count' => $count]) }} </p>
-
Load Localization Scripts (If Using JavaScript):
- If you have JavaScript that needs access to these translations, consider using Laravel's localization packages like laravel-lang/js-localization.
-
Clear Cache (If Needed):
- After making changes to translation files, you might need to clear your configuration cache:
php artisan config:clear php artisan cache:clear php artisan view:clear
- After making changes to translation files, you might need to clear your configuration cache:
Example Blade Template Snippet
Here's how you might update a portion of your Blade template using the translation keys:
<!-- Example: Header Section --> <div class="path"> <span>{{ __('Home') }}</span> / <span>{{ __('Messages') }}</span> </div> <!-- Example: Button --> <button class="btn_actions"> <i class="fa-solid fa-wrench"></i> {{ __('Operations') }} </button> <!-- Example: Confirmation Modal --> <div id="deleteConfirmationModal" class="custom-modal"> <div class="custom-modal-content"> <span class="close">×</span> <h5>{{ __('Delete Confirmation') }}</h5> <p>{{ __('Are you sure you want to delete these messages?') }}</p> <button class="btn btn-primary" id="confirmDelete">{{ __('Confirm') }}</button> <button class="btn btn-close" id="cancelDelete">{{ __('Cancel') }}</button> </div> </div>
Additional Tips
-
Consistency: Ensure that all strings that need translation are wrapped using the
__helper or@langdirective. -
Pluralization: Laravel supports pluralization in translation files. If you have messages that change based on quantity, you can define them accordingly.
-
RTL Support: Since Arabic is a right-to-left (RTL) language, ensure that your CSS handles RTL layouts appropriately when switching locales.
-
Testing: After implementing, test the application in both English and Arabic to ensure that all translations appear correctly and that the layout remains consistent.
Feel free to expand the translation files with more keys as your application grows. This setup will help maintain a scalable and maintainable multilingual application.
-