transifex / transifex-client

The Transifex command-line tool.
https://www.transifex.com/
GNU General Public License v2.0
135 stars 75 forks source link

Change download path when supplied language is source language #324

Closed igavriil closed 3 years ago

igavriil commented 3 years ago

When invoking pull command, with the --language argument supplied, it will use the path dictated by the file_filter as the download path for each language.

This behavior is not altered even when the source language is passed and the source file is downloaded at the path dictated by file_filter and the source_file path that is present in the configuration.

With this commit we can that the language passed is the source language and always store the downloaded file in the source_file path that is present in the configuration

Let's use an example to better illustrate the issue: config:

[project_slug.resource_slug]
file_filter = locale/<lang>/ui.po
source_file = locale/ui.po
source_lang = en
type = PO

Existing behavior: tx pull --language en => download path = locale/en/ui.po

New behavior: tx pull --language en => download path = locale/ui.po

transifexGithub commented 3 years ago

Hello igavriil,

Thank you for contacting Transifex support and submitting your request. Regarding your query, I assume by the example you provided that you want to store the file in your locale folder when the file language is the same as the source language, is that right ?

We currently do no support this, You can either store each file on it's own language directory or all files in the locale folder by removing the "" variable. I believe there is a miss understanding when it comes to your source_file parameter, This path is use as a parameter to upload files to your project.

Let's say you want to upload a file by typing "tx push -s" command, this will look for the file in the source_file path you configured:

Config file: [main] host = https://www.transifex.com lang_map = tr_TR: tr-TR

[en_tr.holvikaari-core_controllers_enyml] filefilter = locale//Global.yml source_file = locale/Global.yml

Command: tx push -s tx INFO: Pushing resource en_tr.holvikaari-core_controllers_enyml tx INFO: Pushing source file (locale/Global.yml) tx ERROR: Could not upload source file. You can use --skip to ignore this error and continue the execution. tx ERROR: [Errno 2] No such file or directory: 'locale/Global.yml'

As you can see on the example above, I wasn't able to upload the file because it doesn't exist in my locale folder!. In order for me to upload the file successfully I will need to place the source file in the locale folder as my configuration file states.

Let me know if this helps you to understand a little bit better how our CLI works :) Best Regards