fixed some translate bugs

main
A1Gard 3 months ago
parent e71a488a93
commit 32f783f198

@ -28,6 +28,10 @@ function getSetting($key)
$a = new \stdClass();
return '';
}
if (config('app.xlang') && ($x->type == 'cat' || $x->type == 'category')) {
$defLang = config('app.xlang_main');
return $x->getTranslations('value')[$defLang];
}
return $x->value;
}
@ -38,12 +42,8 @@ function getSetting($key)
*/
function getSettingCategory($key)
{
$x = Setting::where('key', $key)->first();
if ($x == null) {
$a = new \stdClass();
return '';
}
return Category::where('id', $x->value)->first();
$x = getSetting($key);
return Category::where('id', $x)->first();
}
/***
@ -53,12 +53,8 @@ function getSettingCategory($key)
*/
function getSettingCat($key)
{
$x = Setting::where('key', $key)->first();
if ($x == null) {
$a = new \stdClass();
return '';
}
return Cat::where('id', $x->value)->first();
$x = getSetting($key);
return Cat::where('id', $x)->first();
}
/***
@ -920,8 +916,25 @@ LI;
function xroute($rt, $args = [])
{
if (config('app.xlang_main') != app()->getLocale()) {
return \route( $rt, $args);
return \route($rt, $args);
} else {
return \route($rt, $args);
}
}
function digitsToLatin($number)
{
if ($number == null) {
return null;
}
$latin = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
$persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
$arabic = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
$persian2 = ['\\u06f0', '\\u06f1', '\\u06f2', '\\u06f3', '\\u06f4', '\\u06f5', '\\u06f6', '\\u06f7', '\\u06f8', '\\u06f9'];
$arabic2 = ['\\u0660', '\\u0661', '\\u0662', '\\u0663', '\\u0664', '\\u0665', '\\u0666', '\\u0667', '\\u0668', '\\u0669'];
$number = str_replace($persian, $latin, $number);
$number = str_replace($persian2, $latin, $number);
$number = str_replace($arabic2, $latin, $number);
return str_replace($arabic, $latin, $number);
}

@ -34,7 +34,7 @@
"psr/log": "v2.*",
"symfony/dom-crawler": "^6.2",
"symfony/psr-http-message-bridge": "^7.0",
"xmen/starter-kit": "^v3.2.5"
"xmen/starter-kit": "^v3.2.6"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.12",

14
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "38e039d93317f0accb46bc58aa69b9e1",
"content-hash": "5a74ed8c54adf4fecad63259dcd60136",
"packages": [
{
"name": "artesaos/seotools",
@ -8396,16 +8396,16 @@
},
{
"name": "xmen/starter-kit",
"version": "v3.2.5",
"version": "v3.2.6",
"source": {
"type": "git",
"url": "https://github.com/4xmen/starterkit-for-laravel.git",
"reference": "207cafd1abb67f9a0768223f32490e69d1be8a8d"
"reference": "36cb6a81adaf64e0023d4ab3ffd14630ba8e13c0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/4xmen/starterkit-for-laravel/zipball/207cafd1abb67f9a0768223f32490e69d1be8a8d",
"reference": "207cafd1abb67f9a0768223f32490e69d1be8a8d",
"url": "https://api.github.com/repos/4xmen/starterkit-for-laravel/zipball/36cb6a81adaf64e0023d4ab3ffd14630ba8e13c0",
"reference": "36cb6a81adaf64e0023d4ab3ffd14630ba8e13c0",
"shasum": ""
},
"require": {
@ -8464,9 +8464,9 @@
],
"support": {
"issues": "https://github.com/4xmen/starterkit-for-laravel/issues",
"source": "https://github.com/4xmen/starterkit-for-laravel/tree/v3.2.5"
"source": "https://github.com/4xmen/starterkit-for-laravel/tree/v3.2.6"
},
"time": "2024-02-04T23:17:48+00:00"
"time": "2024-02-09T03:17:55+00:00"
}
],
"packages-dev": [

@ -4,7 +4,7 @@ use Translator\Framework\LaravelConfigLoader;
use Translator\Infra\LaravelJsonTranslationRepository;
return [
'languages' => ["fa","ru"],
'languages' => ["fa","ru","ar"],
'directories' => [
app_path(),
resource_path('views'),

File diff suppressed because one or more lines are too long

@ -50,27 +50,23 @@
<input type="hidden" name="to" v-model="state.range[1]">
</div>
<div v-for="d in elms" :class="cls" v-if="d.searchable">
<div v-if="d.type === 'text'">
<label :for="d.name">
{{ d.label }}
<template v-if="d.type !== 'checkbox'">
<label :for="d.name" >
{{ makeLabel(d.label) }}
</label>
</template>
<div v-if="d.type === 'text'">
<input v-model="defaults[d.name]" type="text" :id="d.name" :name="'meta['+d.name+']'"
class="form-control">
</div>
<div v-else-if="d.type === 'number'">
<label :for="d.name">
{{ d.label }}
<!-- "{{defaults[d.name]}}"-->
</label>
<input type="number" v-model="defaults[d.name]" :placeholder="d.label" :id="d.name"
<input type="number" v-model="defaults[d.name]" :placeholder="makeLabel(d.label)" :id="d.name"
:name="'meta['+d.name+']'" class="form-control">
</div>
<div v-else-if="d.type === 'color'" :id="d.name" :name="'meta['+d.name+']'">
<label :for="d.name">
{{ d.label }}
</label>
<select v-model="defaults[d.name]" :name="'meta['+d.name+']'" :id="d.name" class="form-control">
<option value=""> {{ d.label }}</option>
<option value=""> {{ makeLabel(d.label) }}</option>
<option :style="'background-color:' + o.value " :value="o.value" v-for="o in d.options">
{{ o.title }}
</option>
@ -82,35 +78,28 @@
<input :name="'meta['+d.name+']'" v-model="defaults[d.name]" type="checkbox">
<div class="slider round"></div>
</label>
{{ d.label }}
<span >
</span>
{{ makeLabel(d.label) }}
</div>
<div v-else-if="d.type === 'select'">
<label :for="d.name">
{{ d.label }}
</label>
<select v-model="defaults[d.name]" :name="'meta['+d.name+']'" :id="d.name" class="form-control">
<option value=""> {{ t.all }}</option>
<option :value="o.value" v-for="o in d.options"> {{ o.title }}</option>
</select>
</div>
<div v-else-if="d.type === 'multi'">
<label :for="d.name">
{{ d.label }}
</label>
<multiselect :multiple="true" :taggable="true" label="title" v-model="defaults[d.name]"
:placeholder="d.label" :options="d.options"></multiselect>
:placeholder="makeLabel(d.label)" :options="d.options"></multiselect>
<input :id="d.label" type="hidden" :name="'meta['+d.name+']'" :value="makeVal(defaults[d.name])">
</div>
<div v-else-if="d.type === 'singlemulti'">
<label :for="d.name">
{{ d.label }}
</label>
<multiselect @remove="rem(d.name,$event)" @select="upd(d.name,defaults[d.name])"
v-model="defaults[d.name]" :multiple="true" :taggable="true" label="title"
:placeholder="d.label" :options="d.options"></multiselect>
:placeholder="makeLabel(d.label)" :options="d.options"></multiselect>
<input type="hidden" :name="'meta['+d.name+']'" :value="makeVal(defaults[d.name])">
</div>
</div>
@ -177,7 +166,7 @@ export default {
state: {range: [parseInt(this.minm), parseInt(this.maxm)], number: 1000}
}
},
props: ['jdata', 'searchable', 'defz', 'cls', 'minm', 'maxm'],
props: ['jdata', 'searchable', 'defz', 'cls', 'minm', 'maxm','langg'],
mounted() {
this.updateJdata(this.jdata, this.defz);
if (getParameterByName('to') !== null) {
@ -196,6 +185,13 @@ export default {
},
methods: {
makeLabel(lbl){
if ( typeof lbl == 'object'){
return lbl[this.langg];
}else{
return lbl;
}
},
apply: function () {
this.$refs.filter.submit();
},

@ -26,9 +26,9 @@
":app Dear customer Your :product signed for you.": ":app\nکاربر گرامی محصول «:product» برای شما ثبت شد.",
"A fresh verification link has been sent to your email address.": "یک لینک تاییده برای شما ایمیل شد",
"ACL": "سطح دسترسی",
"AI translate form original source": "",
"AI translate form original source": "ترجمه از منبع اصلی با هوش مصنوعی",
"ANSWERED": "پاسخ‌ داده شده",
"API error!": "",
"API error!": "خطای API",
"Action": "عملیات",
"Actions": "عملیات",
"Active": "فعال",
@ -84,6 +84,7 @@
"COMPLETED": "تکمیل شده",
"Call us!": "تماس بگیرید!",
"Canceled": "لغو شده",
"Card": "سبد خرید",
"Card cleared": "کارت خالی شد",
"Cat": "دسته محصول",
"Catalog": "کاتالوگ",
@ -155,7 +156,7 @@
"Deactivate": "غیرفعال",
"Deactive": "غیرفعال",
"Dear customer, Please complete your information": "مشتری عزیز، لطفا اطلاعات خود را تکمیل کنید",
"Default": "",
"Default": "پیش‌فرض",
"Delete": "حذف",
"Description": "توضیحات",
"Description Text": "توضیحات کامل",
@ -176,6 +177,7 @@
"Draft now": "پیش‌نویس کن",
"Drafted": "پیش‌نویس شده",
"E-Mail Address": "رایانامه\/ایمیل",
"E-mail": "رایانامه",
"Edit": "ویرایش",
"Edit Discount": "ویرایش تخفیف",
"Edit Menu": "ویرایش منو",
@ -265,7 +267,7 @@
"Lang": "زبان",
"Language list": "فهرست زبان‌ها",
"Languages": "زبان‌ها",
"Languages translate": "",
"Languages translate": "ترجمه زبان‌ها",
"Last update": "آخرین به‌روز‌رسانی",
"Last video": "واپسین فیلم",
"Leave your comment": "ارسال دیدگاه",
@ -278,7 +280,7 @@
"Magazine": "مجله",
"Main address": "آدرس اصلی",
"Main category": "سرفصل اصلی",
"Main language content": "",
"Main language content": "محتوای زبان اصلی سایت",
"Main product category": "دسته اصلی محصول",
"Manage": "مدیریت",
"Max click": "حداکثر تعداد کلیک",
@ -289,7 +291,7 @@
"Message": "پیام",
"Metas and publish": "ویژگی ها و انتشار",
"Mobile": "موبایل",
"Model": "",
"Model": "مدل",
"Monday": "دوشنبه",
"Multi level select type": "نوع چند مرحله ای",
"Multi select type": "نوع انتخالی چند گانه",
@ -350,7 +352,7 @@
"Payment Type": "نحوه پرداخت",
"Payment error": "خطا در پرداخت",
"Payment price:": "مبلغ قابل پرداخت",
"Pediatric dental clips": " ",
"Pediatric dental clips": "",
"Pending": "در انتظار",
"Phone": "تلفن‌تماس",
"Pictures": "تصاویر",
@ -446,6 +448,7 @@
"Save sort": "ذخیره مرتب شده",
"Search": "جستجو",
"Search for": "جستجو برای",
"Search for ...": "جستجو برای ...",
"Search for:": "جستجو برای:",
"Search in all panel": "جستجو در کل پنل",
"Searchable": "قابل جستجو",
@ -513,10 +516,10 @@
"Total amount": "مقدار کل",
"Tracking code": "کد رهگیری",
"Translate": "ترجمان",
"Translate model": "",
"Translate model": "ترجمه موجودیت",
"Translate updated": "ترجمه به روز شد",
"Translate with AI": "ترجمه با کمک هوش مصنوعی",
"Translated by ai xstack service:": "",
"Translated by ai xstack service:": "ترجمه توسط سرویس اکس استک",
"Translates": "ترجمان",
"Transport": "روش ارسال",
"Transport method": "شیوه ارسال",
@ -540,7 +543,7 @@
"Username": "نام کاربری",
"Users": "کاربران",
"Users list": "فهرست کاربران",
"Value": "",
"Value": "مقدار",
"Verify Your Email Address": "تایید رایانامه یا ایمیل خود",
"Video clip": "ویدئو کلیپ",
"Video clips": "کلیپ ها",

@ -51,6 +51,7 @@
"CLOSED": "ЗАКРЫТО",
"Call us!": "Позвоните нам!",
"Canceled": "Отменено",
"Card": "",
"Card cleared": "Карта очищена",
"Cat": "",
"Catalog": "Каталог",
@ -129,6 +130,7 @@
"Draft now": "Создать черновик",
"Drafted": "Создан черновик",
"E-Mail Address": "Адрес электронной почты",
"E-mail": "",
"Edit": "Редактировать",
"Edit Discount": "Редактировать скидку",
"Edit Menu": "Редактировать меню",
@ -222,6 +224,7 @@
"Menus": "«Меню»",
"Menus list": "«Список меню»",
"Menus preview": "«Предварительный просмотр меню»",
"Message": "",
"Metas and publish": "«Метаинформация и публикация»",
"Mobile": "«Мобильный»",
"Model": "",
@ -353,6 +356,7 @@
"Save sort": "«Сохранить сортировку»",
"Search": "Поиск",
"Search for": "Искать",
"Search for ...": "",
"Search in all panel": "«Поиск по всей панели»",
"Searchable": "Доступно для поиска",
"Section": "Раздел",
@ -361,10 +365,12 @@
"Send Answer": "«Отправить ответ»",
"Send Answer and close": "«Отправить ответ и закрыть»",
"Send Password Reset Link": "«Отправить ссылку для сброса пароля»",
"Send comment": "",
"Send new ticket": "«Отправить новый билет»",
"Setting": "Параметр",
"Setting added to website": "«Настройка добавлена на сайт»",
"Setting of website updated": "«Настройки сайта обновлены»",
"Shopping Card": "",
"Shopping card": "«Покупательная карточка»",
"Short text": "«Короткий текст»",
"Show": "Показывать",

@ -18,24 +18,35 @@
window.translate.true = `{{ __('True') }}`;
window.translate.false = `{{ __('False') }}`;
window.translate.errMobile = `{{ __('Incorrect mobile number') }}`;
window.translate.discountCodeError= `{{ __('Discount code incorrect') }}`;
window.translate.discountCodeAccept= `{{ __('Discount code accepted') }}`;
window.translate.discountCodeError = `{{ __('Discount code incorrect') }}`;
window.translate.discountCodeAccept = `{{ __('Discount code accepted') }}`;
@if(request()->route('lang') != null)
// Get all anchor elements on the page
let links = document.getElementsByTagName('a');
// Get all anchor elements on the page
let links = document.getElementsByTagName('a');
const webBase = window.location.protocol + '//' + window.location.host;
// Loop through each anchor element
for (let i = 0; i < links.length; i++) {
let link = links[i];
const webBase = window.location.protocol + '//' + window.location.host;
// Loop through each anchor element
for (let i = 0; i < links.length; i++) {
let link = links[i];
// Check if the href attribute starts with webBase
if (link.href.indexOf(webBase) === 0) {
// Prefix '/en' to the href attribute
link.href = '/{{request()->route('lang')}}' + link.href.substring(webBase.length);
}
// Check if the href attribute starts with webBase
if (link.href.indexOf(webBase) === 0) {
// Prefix '/en' to the href attribute
link.href = '/{{request()->route('lang')}}' + link.href.substring(webBase.length);
}
}
@endif
var isRtl = false;
@php
$lang = \App\Models\Xlang::where('tag',request()->route('lang'))->first();
@endphp
@if($lang !== null && $lang->rtl)
isRtl = true;
@endif
if (!isRtl) {
document.querySelector('body').style.direction = 'ltr';
}
</script>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">

@ -27,6 +27,7 @@
@if($lang !== null && $lang->rtl)
isRtl = true;
@endif
@if(config('app.xlang_main') == 'fa' || config('app.xlang_main') == 'ar')
isRtl = true;
@endif

@ -39,6 +39,7 @@
:maxm="{{$cat->products()->max('price')}}"
@else
:maxm="1000000000"
langg="{{config('app.locale')}}"
@endif
>

@ -107,7 +107,7 @@
<div class="col-lg-4 col-md-6">
<div class="input-group flex-nowrap" style="margin-top: 1em;">
<input type="text" id="searching" data-url="{{route('search','')}}"
data-ajax="{{route('search.ajax')}}" class="form-control" placeholder="جستجو در محصولات..."
data-ajax="{{route('search.ajax')}}" class="form-control" placeholder="{{__("Search for ...")}}"
aria-label="search"
aria-describedby="addon-wrapping">
<span class="input-group-text" id="addon-wrapping">
@ -118,7 +118,7 @@
<div class="col-lg-4 text-end col-md-6">
<a type="button" class="btn btn-primary position-relative" href="{{route('card.show')}}">
<i class="icofont-shopping-cart"></i>
سبد خرید
{{__("Card")}}
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-primary">
<b id="card-count">
{{\App\Helpers\cardCount()}}
@ -143,5 +143,4 @@
</div>
</div>
</section>
@include('website.component.navbar2')
@include('website.component.navbar')

@ -58,8 +58,9 @@
<div class="alert alert-secondary" id="comment-form">
@include('starter-kit::component.err')
<h5>
ارسال دیدگاه
{{__("Send comment")}}
</h5>
<form class="xsumbmiter non-print" method="post" id="comment-form-body" action="no-action">
<input type="hidden" id="smt" value="{{route('comment.post',$post->slug)}}">
@csrf
@ -71,7 +72,7 @@
</label>
<textarea required="" minlength="10" id="comment-message"
name="body" class="ckeditorx form-control " placeholder="پیام"
name="body" class="ckeditorx form-control " placeholder="{{__("Message")}}"
rows="4"></textarea>
</div>
</div>
@ -79,7 +80,7 @@
<div class="form-group">
<input name="name" required="" minlength="2" type="text"
class="form-control " placeholder="نام" value=""
class="form-control " placeholder="{{__("Name")}}" value=""
id="name">
</div>
</div>
@ -87,14 +88,14 @@
<div class="form-group">
<input required="" name="email" id="email" type="email"
class="form-control " placeholder="ایمیل" value="">
class="form-control " placeholder="{{__("E-mail")}}" value="">
</div>
</div>
<div class="col-md-12">
<label> &nbsp;</label>
<input name="" type="submit" class="btn btn-primary mt-2"
value="ارسال دیدگاه">
value="{{__("Send")}}">
</div>
</div>
</form>

@ -274,7 +274,7 @@
<div class="alert alert-secondary" id="comment-form">
@include('starter-kit::component.err')
<h5>
ارسال دیدگاه
{{__("Send comment")}}
</h5>
<form class="xsumbmiter non-print" method="post" id="comment-form-body"
action="no-action">
@ -289,7 +289,7 @@
</label>
<textarea required="" minlength="10" id="comment-message"
name="body" class="ckeditorx form-control " placeholder="پیام"
name="body" class="ckeditorx form-control " placeholder="{{__("Message")}}"
rows="4"></textarea>
</div>
</div>
@ -297,7 +297,7 @@
<div class="form-group">
<input name="name" required="" minlength="2" type="text"
class="form-control " placeholder="نام" value=""
class="form-control " placeholder="{{__("Name")}}" value=""
id="name">
</div>
</div>
@ -305,14 +305,14 @@
<div class="form-group">
<input required="" name="email" id="email" type="email"
class="form-control " placeholder="ایمیل" value="">
class="form-control " placeholder="{{__("E-mail")}}" value="">
</div>
</div>
<div class="col-md-12">
<label> &nbsp;</label>
<input name="" type="submit" class="btn btn-primary mt-2"
value="ارسال دیدگاه">
value="{{__("Send")}}">
</div>
</div>
</form>

Loading…
Cancel
Save