Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change download path when supplied language is source language #324

Merged
merged 1 commit into from
Jun 25, 2021

Conversation

igavriil
Copy link
Contributor

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

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
Copy link

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]
file_filter = 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

Copy link

@kostasgeo kostasgeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@igavriil igavriil merged commit 902d667 into master Jun 25, 2021
@igavriil igavriil deleted the respect_source_file_when_language_supplied branch June 25, 2021 09:51
igavriil added a commit that referenced this pull request Jun 28, 2021
Merged PRs:
* #324 Change download path when supplied language is source language
@igavriil igavriil mentioned this pull request Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants