You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xshop/resources/views/component/lang.blade.php

53 lines
2.0 KiB
PHTML

2 years ago
<script>
var isInit = false;
var uploadFormData = [];
2 years ago
var appName = `{{config('app.name')}}`;
2 years ago
window.translate = {};
window.translate.next = `{{__('Next')}}`;
window.translate.prev = `{{__('Previous')}}`;
window.translate.finishAndSave = `{{__('Finish and save')}}`;
window.translate.specialQuantity = `{{__('Special quantity')}}`;
window.translate.choose = `{{__('Choose one')}}`;
window.translate.remove = `{{__('Remove')}}`;
window.translate.price = `{{__('Price')}}`;
window.translate.count = `{{__('Count')}}`;
window.translate.from = `{{__('From')}}`;
window.translate.to = `{{__('To')}}`;
window.translate.all = `{{__('All')}}`;
window.translate.priceRange = `{{__('Price range')}}`;
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') }}`;
10 months ago
@if(request()->route('lang') != null)
// Get all anchor elements on the page
let links = document.getElementsByTagName('a');
10 months ago
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];
10 months ago
// 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);
10 months ago
}
}
10 months ago
@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';
}
2 years ago
</script>
<link href="{{ asset('css/app.css') }}" rel="stylesheet">