Closed rabol closed 12 months ago
I most have been sleeping.... second time I tried it worked - sorry
<x-select
label="{!! __('Select subscription') !!}"
:options="$subscriptions"
option-value="id"
option-label="name"
placeholder="Select subscription"
wire:model="selectedSubscription"
id="subscriptions"
/>
this does not work
Good morning. I tested it locally and it worked normally. Thank you very much in advance.
Not sure why you close this issue
How did you test ?
<x-button label="Créer un ticket d'assistance" />
will give you a button like this:
but this write the text correct
<span>Créer un ticket d'assistance</span>
This is not a bug in WireUI. Try rendering this directly on your blade and see what the result is.
{{ 'Créer un ticket d'assistance' }}
You are not handling HTML.
this works: html button
<button class="border border-gray-500 p-4">{{__('Create support ticket')}}</button>
this does not: wireui button
<x-button label="{{__('Create support ticket')}}" />
This isn't work:
<button class="border border-gray-500 p-4">{{ __('Create support ticket') }}</button>
Bus this is work:
<button class="border border-gray-500 p-4">{!! __('Create support ticket') !!}</button>
Via label it is just treated as string, not as HTML. This is a limitation of Components within Laravel.
for the future:
<div class="grid grid-cols-1">
<div class="mt-2">
<x-button red label="{!! __('Create support ticket')!!}" />
</div>
<div class="mt-2">
<x-button red >{{ __('Create support ticket') }}</x-button>
</div>
<div class="mt-2">
<x-button green>{!! __('Create support ticket') !!}</x-button>
</div>
<div class="mt-2">
<button class="bg-green-500 border border-gray-500 p-4">{!! __('Create support ticket') !!}</button>
</div>
<div class="mt-2">
<x-test class="bg-green-500" label="{{ __('Create support ticket') }}" />
</div>
<div class="mt-2">
<x-test class="bg-green-500" >{!! __('Create support ticket') !!}</x-test>
</div>
</div>
and the component that can handle html
@props(['label'])
<div {{ $attributes->merge(['class' => '']) }}>
@if(isset($label))
{!! html_entity_decode($label) !!}
@else
{{ $slot }}
@endif
</div>
and the fr.json
{
"Create support ticket": "Créer un ticket d'assistance"
}
the result:
One way is decoding to HTML, but this can be done before assigning to the label.
Describe the bug When working with multi language web sites I use __('') to do translation of texts.
In the french language there is a lot of apostrophes accents etc. like this:
and if one uses html entities to display strings
them the label / slot does not look correct.
To Reproduce Steps to reproduce the behavior:
<x-button primary type="submit" >{{ __("Create support ticket") }} </x-button>
"Create support ticket": "Créer un ticket d'assistance",
Expected behavior That the label is correct.
Screenshots or Videos If applicable, add screenshots or videos to help explain your problem.
Dependencies