Closed pepinows closed 4 years ago
Hi @pepinows
I like this suggestion with callback function where you can do whatever you want with output so I'll go in that direction, but I don't know when will I have time for that.
If you wish you can create PR.
@pepinows I have just added callback to new release https://github.com/kg-bot/laravel-localization-to-vue/tree/v1.6.4, you can see example at https://github.com/kg-bot/laravel-localization-to-vue/tree/v1.6.4#settings-and-configuration
Hello, i'm using your package together with https://kazupon.github.io/vue-i18n/ Here is the thing: Laravel translation parameters look like ":parameter" Vuei18n expects "{parameter}"
This is my solution:
Route::get('/lang/localization.js', function () { $translate = ExportLocalization::export()->toArray(); array_walk_recursive($translate, function (&$v, $k) { $v = preg_replace('/:(\w+)/', '{$1}', $v); }); return response()->json($translate); });
(applied a regex replace on every translated string)It would be nice to have a built-in callback setting to customize the output