martinlindhe / laravel-vue-i18n-generator

Generates a vue-i18n compatible include file from your Laravel translations
MIT License
306 stars 207 forks source link

Lang keys containing colons #84

Closed priithansen closed 5 years ago

priithansen commented 5 years ago

Hei

Our lang keys are separated with colons (:) for namespacing reasons and it seems that all keys are also sent through adjustString() which replaces them similar to values. I can't think of the benefit of sending keys through the same transformation, am I missing something?

'spa:page:title:dashboard' => 'Dashboard',

ends up

 "spa{page}{title}{dashboard}": "Dashboard",
martinlindhe commented 5 years ago

Colons are used in laravel translations to indicate named parameters, which is translated to {name} which is vue-i18n syntax.

Most people use dot to namespace their translation strings, such as 'spa.page.title.dashboard' => 'Dashboard', which is also what you'd see in the Laravel manual.

priithansen commented 5 years ago

Jeah named parameters make sense but why even parse them from keys as there are no parameters there?

As for me it seems it just disables using : in translation keys without any benefit?

martinlindhe commented 5 years ago

Current behavior was implemented to fix #64.