xiCO2k / laravel-vue-i18n

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

Support json with nested structure #53

Closed Metilar closed 2 years ago

Metilar commented 2 years ago

Vue i18n supports json with a nested structure.

JSON:

{
  message: {
    hello: 'Hello world'
  }
}

Template:

<p>{{ $t('message.hello') }}</p>

I tried that, but the translation returns the keys.

xiCO2k commented 2 years ago

Hey @Metilar can you check if that works, on the PHP side with the {{ _('message.hello') }}?

Thanks for the help.

Metilar commented 2 years ago

Hey @Metilar can you check if that works, on the PHP side with the {{ _('message.hello') }}?

Thanks for the help.

No, if I understand correctly, this is supported specifically in i18n

xiCO2k commented 2 years ago

Hey @Metilar just tested on just the Laravel stack and its not supported.

image

Since this package follows the i18n rules from Laravel I will not add that for now, if you want to PR that to the Laravel core, then I will be happy to include here.

Thanks.

onlime commented 1 year ago

@taylorotwell has rejected https://github.com/laravel/framework/pull/42226 in May 2022, just for reference. I would still love to see this happen in both Laravel and laravel-vue-i18n, but find it smart you follow strict i18n rules from Laravel in this package.