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

How to tell tx where to download the files? #171

Open
Sopor opened this issue Mar 19, 2023 · 2 comments
Open

How to tell tx where to download the files? #171

Sopor opened this issue Mar 19, 2023 · 2 comments

Comments

@Sopor
Copy link

Sopor commented Mar 19, 2023

In the old tx i used:
/usr/local/bin/tx --root /home/username/lang/convert pull -a and the files was downloaded in to a directory called en_examplexml full path /home/username/lang/convert/en_examplexml and it doesn't matter where i ran the tx command from.

In this new version i run tx --config /home/username/lang/convert/.tx/config pull -a, but this new version will create the directory en_examplexml in the same directory i run tx from and download the files in to en_examplexml.

I have tried to use --root-config, but it want a file and not a directory.

If i add the path to the config after --root-config file it tell me that i need to run tx init.

So, what is the difference between --root-config and --config?

It seems that i'm forced to run tx in the same directory as the .tx directory or what am i doing wrong?

@kbairak
Copy link
Member

kbairak commented Mar 28, 2023

So, what is the difference between --root-config and --config?

The root configuration holds your API token for interacting with transifex while the local configuration holds your project's setup, ie which remote resources map to which local files (and what file format they use and potential language mappings etc). The reason for this distinction is that local configurations can be committed to your version control system and thus shared with other teammates while API tokens shouldn't.

If you don't use the --root-config and/or --config flags, then the root configuration will be read from ~/.transifexrc (in Linux/MacOS systems) and the local configuration will be read from ./.tx/config. You can use these flags to override the paths.

It seems that i'm forced to run tx in the same directory as the .tx directory or what am i doing wrong?

It seems you are correct. We don't have a way to override the "working directory" of the application. So you will need to cd into your project's directory before running the command. We could look into bringing the --root flag back (although if we did I would propose renaming it to --pwd or --cwd or something like that) but we would have to measure its importance. For example, would not having this flag break your workflow? Are you aware of other similar tools that do have this option?

@Mi605
Copy link

Mi605 commented Mar 28, 2023

So you will need to cd into your project's directory before running the command.

As a workaround you can edit the ./.tx/config file manually. Just add the full absolute target path to the lines file_filter and source_file, then tx client will write and read it's output and input files from and to the desired directories, regardless from where it was called. (You'll have to create the needed subdirectories manually beforehand in this case, otherwise tx client hangs forever on execution.) If you don't want to modify your original config, just copy it to config-temp, modify the -temp copy of the config file and run tx with -c '/path/to/config-temp' option.

We could look into bringing the --root flag back (although if we did I would propose renaming it to --pwd or --cwd or something like that) but we would have to measure its importance.

If asked, I'd consider such a flag useful for temporary out of default workflow testing and checking translations without touching current state of default local copy by redirecting them to another directory. But as said, the same can be achieved by the described workaround as well.

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

No branches or pull requests

3 participants