mirego/accent

Accent CLI sync doesn't respect folder tree

Closed this issue · 1 comments

Hi,

Sorry it's me again!

Giving a project having the translations in multiple files and folders like this:

lang
|_ en
  |_feature1
    |_trans1.php
    |_trans2.php
  |_feature2
    |_trans3.php
  |_base.php

I tried a lot of configuration but I'm unable to keep this structure in my second langage during a sync.

First scenario :

    "files": [
        {
            "language": "en",
            "format": "laravel_php",
            "source": "lang/en/**/*.php",
            "target": "lang/%slug%/%document_path%.php"
        }
    ]

With this configuration, all my files are sync in the same directory, in both languages! So I got:

lang
|_ en
  |_feature1
    |_trans1.php
    |_trans2.php
  |_feature2
    |_trans3.php
  |_base.php
  |_trans1.php
  |_trans2.php
  |_trans3.php
|_fr
  |_base.php
  |_trans1.php
  |_trans2.php
  |_trans3.php  

Second scenario :

    "files": [
        {
            "language": "en",
            "format": "laravel_php",
            "source": "lang/en/**/*.php",
            "target": "lang/%slug%/%document_path%.php"
        },
        {
            "language": "en",
            "format": "laravel_php",
            "source": "lang/en/feature1/*.php",
            "target": "lang/%slug%/feature1/%document_path%.php"
        },
        {
            "language": "en",
            "format": "laravel_php",
            "source": "lang/en/feature2/*.php",
            "target": "lang/%slug%/feature2/%document_path%.php"
        }
    ]

With this configuration, all my files are duplicated in each directory (base, feature1, feature2), in both languages.

I also tried to avoid a file at the base to remove the config with a glob but I got the same effect.

Is it something supported and I did something wrong in my configuration? I did assume it was as the configuration support an array of files but I'm misunderstanding this part of the configuration?
Or should it be a feature request?

Another side effect: If I have 2 files with the same name (like feature1/common.php and feature2/common.php), one will be override by the second.

Thanks in advance!

Not very helpful, but:

With this configuration, all my files are duplicated in each directory (base, feature1, feature2), in both languages

Ran into exact same problem and also tried every possible combination; in the end decided to just flatten the folder structure as only had two extra folders. I didn't looked into source, but it seems like folder/filename structure is not quite recognized by design? I guess even if you add file via UI ("Files" section) it just kinda assumes flat structure 🤔