xiCO2k / laravel-vue-i18n

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

Multiple occurrence of variable issue #137

Closed xiki808 closed 1 year ago

xiki808 commented 1 year ago

Hi, this issue is showing up again: https://github.com/xiCO2k/laravel-vue-i18n/issues/91

I'm with version 2.5.1

xiCO2k commented 1 year ago

can you provide an example, we have a test for that and it's still passing.

xiki808 commented 1 year ago

In my laravel project /lang/cv.php I have:

'test_var' => 'This is a var :site_name and this is the same var :site_name',

And in my component:

<span>
{{
    trans('cv.test_var', {
      site_name: 'mysite.com',
    })
  }}
</span>

What's printed: This is a var mysite.com and this is the same var :site_name

I'm using Inertia to load and render pages.

xiCO2k commented 1 year ago

got it, will check that out.

xiCO2k commented 1 year ago

I was unable to reproduce it, and there is a test to reproduce it.

Check this: https://github.com/xiCO2k/laravel-vue-i18n/blob/main/test/translate.test.ts#L84-L90

Also you can try using the $t() helper instead.