[Vuejs]-Problem with JSON encoded string from "kg-bot/laravel-localization-to-vue"

0👍

Finally I found the problem.
I patched vendor\kg-bot\laravel-localization-to-vue\src\Classes\ExportLocalizations.php and replaced

// Check if language already exists in array
if (array_key_exists($language, $this->strings)) {
    if (array_key_exists($packageName, $this->strings[$language.'.'.$packageName])) {
        $this->strings[$language.'.'.$packageName] =
            array_replace_recursive((array) $this->strings[$language.'.'.$packageName], (array)
            $fileContents);
    } else {
        $this->strings[$language.'.'.$packageName] = $fileContents;
    }
} else {
    $this->strings[$language] = [
        $packageName => $fileContents,
    ];
}

with

$this->strings[$language.'.'.$packageName] = $fileContents;

now the json is correct formed for lang.js

Leave a comment