xiCO2k / laravel-vue-i18n

Allows to connect your `Laravel` Framework translation files with `Vue`.
MIT License
606 stars 50 forks source link

Enum does not seem to work #132

Closed ludoguenet closed 1 year ago

ludoguenet commented 1 year ago

Hello !

I am using Enum for translations like so:

fr/categories.php

return [ EnumCategory::FIRST->value => 'Première catégorie', EnumCategory::SECOND->value => 'Seconde catégorie', ];

It appears that in my Vue Component (in Blade view), it does not show up :

{{ $t('categories.' + item.category) }}

Key is defined this way : "categories.undefined":"Première catégorie"

Nevertheless, when I define hardcoded values, it is working great :

fr/categories.php

return [ 'first_category' => 'Première catégorie', 'second_category' => 'Seconde catégorie', ];

Key is defined this way : "categories.first_category":"Première catégorie"

Thanks for reading me!

xiCO2k commented 1 year ago

Can you create a public repo with this issue?

Thanks

ludoguenet commented 1 year ago

I will attempt to replicate the issue from the private app I'm currently developing. The challenge lies in the fact that this particular app was initially built with Laravel 9 and later updated to version 10.x, where the i18n functionality is functioning correctly.

However, whenever I try to create a Laravel 10 application from scratch, I encounter the same issue mentioned in this GitHub thread: https://github.com/xiCO2k/laravel-vue-i18n/issues/128

xiCO2k commented 1 year ago

Got it, will follow up on the #128