martinlindhe/laravel-vue-i18n-generator

Having JSON and Array translations at the same time

lk77 opened this issue · 5 comments

lk77 commented

Hello,

i seems that it's not possible to have json translations and array translations at the same time,
when using --multi-locales option.

In Generator.php line 75 :

if ($fileinfo->isDir()) {
                    $local = $this->allocateLocaleArray($fileinfo->getRealPath());
                } else {
                    $local = $this->allocateLocaleJSON($fileinfo->getRealPath());
                    if ($local === null) continue;
                }

if the locale exist as a directory, then the json translation is never applied.

thanks.

Could you give an example?

How does your directory structure look, please provide output of tree command.

What is the expected result, versus actual result?

lk77 commented

There is the tree output :

├── en
│   ├── auth.php
│   ├── pagination.php
│   ├── passwords.php
│   └── validation.php
├── fr
│   ├── auth.php
│   ├── pagination.php
│   ├── passwords.php
│   └── validation.php
└── fr.json

the expected result is the inclusion of the translations in fr.json in the final fr.js generated in resources/assets/js/langs/fr.js, which is not the case.

Only the translations in the *.php files are included.

If i don't use --multi-locales options, translations from fr.js are correctly included

"fr": {
        "I love programming.": "J'aime programmer",
        "pagination": {
            "previous": "« Précédent",
            "next": "Suivant »"
        },
[...]

with --multi-locales option :

"fr": {
        "pagination": {
            "previous": "« Précédent",
            "next": "Suivant »"
        },

This should be fixed by #96

lk77 commented

Thanks !

lk77 commented

Hello,

i reopen the issue since #96 was reverted.

@martinlindhe