laravel-vue-i18n-generator icon indicating copy to clipboard operation
laravel-vue-i18n-generator copied to clipboard

Having JSON and Array translations at the same time

Open lk77 opened this issue 6 years ago • 5 comments

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.

lk77 avatar Jun 04 '19 09:06 lk77

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?

martinlindhe avatar Jun 04 '19 09:06 martinlindhe

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 »"
        },

lk77 avatar Jun 04 '19 10:06 lk77

This should be fixed by #96

murrant avatar Oct 23 '19 13:10 murrant

Thanks !

lk77 avatar Oct 24 '19 06:10 lk77

Hello,

i reopen the issue since #96 was reverted.

@martinlindhe

lk77 avatar Feb 27 '20 11:02 lk77