How to put the translation inside another folder

hi, sorry for not very clever question, but unfortunately I can’t get the translation path right, here is my case

image

I have a raw folder that I have raw translation keys. I extract any new key in my app into that folder. (red box)

I want to configure corwdin to put the translations into another folder (blue box). so my key extractor can clean up the raw folder easily and create keys from scratch

so I created this yml file

files:
  - source: "/raw/**/*.json"
    translation: /translations/%two_letters_code%/%original_path%/%original_file_name%

my issue is, the translation includes all the folder from the root, I don’t want the raw to be included in here in the path. I want anything inside the raw folder. but I can’t figure it out how to get only content of a folder

if I use %original_path% it will have raw as part of the path and if I don’t use it, it won’t create nested folders (like welcome).

I expect the output be like this

->translations 
         |-en
         |   |- welcome 
         |   |        |-transalation.json
         |   |
         |   |-translation.json
         |
         |-fa
         |  |- welcome 
         |  |        |-transalation.json
         |  |
         |  |-translation.json

Is the folder big?

I mean, with first set up you write down the path more detailed, and that just run file update/ translation download.

Asterisks grab all content, try more specific, something like /folder1/folder2/folder3/folder4/*.json

no, the folder isn’t big, but I should be able to set the root folder. current behavior is a crisis for mono repos.

imagine this folder structure

i18n/
├─ welcome/
│  ├─ translation.json
├─ translation.json

crowdin will produce this output

en/
├─ i18n/
│  ├─ translation.json
│  ├─ welcome/
│  │  ├─ translation.json
fa/
├─ i18n/
│  ├─ translation.json
│  ├─ welcome/
│  │  ├─ translation.json

in my example the root of the folder is i18n. imagine root of the folder was /app/app-name/src/lib/assets/i18n/.

I will end up with a translation in /en/app/app-name/src/lib/assets/i18n/.
then how the translation branch (‘i18n_main’) could merge with the main branch. we are simply writing into another folder structure different from main branch

you see where it goes wrong? I can’t manage where the translation goes. sure I can write custom scripts to copy the translations into different folders but that’s a path that I prefer not to go and let the branch merging solve the conflict.

I should be able to set the root for the source. but I can’t find any setting that let me to configure it. now always the root of the source is / and any folder structure from there is copied until the end of the node. which doesn’t make sense. if I set the destination folder as same as the folder that source files are, just for purpose of having the source and translation in one folder I end up with a path like this

/app/app-name/src/lib/assets/i18n/en/app/app-name/src/lib/assets/i18n/

and being specific isn’t an option, I can’t be specific for 100 files that could be updated/deleted/renamed on daily basis. that’s why we are using glob, isn’t it?

Hello @mhamri

Try using code like this one: /translations/%two_letters_code%/**/%two_letters_code%.%file_extension%

thanks @Dima, Interestingly I came up with something similar two days ago

/translations/**/%two_letters_code%.%file_extension%

but I came up with this solution on pure luck. there was no reference about this in the documentation and I was just playing with things and saw this finally worked. I didn’t understand why ** work different than the %original_path% and why %original_path%create a separate folder while ** merge the folder structure from root folder.

but yea, you are right, it magically works! :smiley:

Hello, @mhamri

I’m glad that magic still exists in our worlds (Hoghwarts wizards entered the chat)🧙‍♂️