xiCO2k / laravel-vue-i18n

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

All `/` are replaced with `.` #115

Closed BR0kEN- closed 1 year ago

BR0kEN- commented 1 year ago

If a translatable key is not in the source file, then the wTrans() will replace all slashes with dots in it.

That's the case when English strings are used as an input to the translation functions with the plan for later to become IDs for their localizations.

Current behavior:

import { trans } from 'laravel-vue-i18n';

console.assert(trans('Active / Overdue') === 'Active . Overdue'); // true

Expected behavior

import { trans } from 'laravel-vue-i18n';

console.assert(trans('Active / Overdue') === 'Active / Overdue'); // true

To overcome this issue, you're forced to create the en.json where keys and values are going to be equal however why would you need that file to translate English into English?

BR0kEN- commented 1 year ago

Before https://github.com/xiCO2k/laravel-vue-i18n/pull/89 it was not possible at all to have slashes in the key. Since then it is, however the source JSON is mandatory.

BR0kEN- commented 1 year ago

https://github.com/xiCO2k/laravel-vue-i18n/pull/116 reveals the issue and proposes a fix.