crowdin / crowdin-cli

A command-line client for the Crowdin API
https://crowdin.github.io/crowdin-cli
MIT License
250 stars 94 forks source link

Crowdin CLI does not respect the `export_languages` in the configuration file #863

Closed amir1376 closed 1 month ago

amir1376 commented 1 month ago

Describe the bug It seems that Crowdin CLI does not respect the export_languages in the configuration file

To Reproduce Steps to reproduce the behavior:

  1. Configuration file:
    
    "project_id_env": "CROWDIN_PROJECT_ID"
    "api_token_env": "CROWDIN_PERSONAL_TOKEN"
    "base_path": "."
    "base_url": "https://api.crowdin.com"
    "preserve_hierarchy": true
    files: [
    {
    "source": "/resources/locales/en_US.properties",
    "translation": "/resources/locales/%locale_with_underscore%.properties",
    }
    ]

"export_languages": [ "ar","fa","fr" ]



3. Execute CLI command: `crowdin download`
4. See an error

**Expected behavior**
I expect that Crowdin CLI only downloads the specified languages which is defined in the `configuration file`. but it simply downloads all languages!

**Environment:**
 - OS: Windows
 - Version 11

**Additional context**
I use this feature because I have lots of languages in my crowdin project.
but I only want to download languages which are ready to use.
I know that there is an option in Crowdin CLI but why it is not respecting the `configuration file's value` here?
andrii-bodnar commented 1 month ago

Thanks for the request. The export_languages configuration is for VCS Integrations only. In CLI you can pass languages as command options: crowdin pull -l fr, crowdin pull -l uk, etc.

Implementing export_languages support in the CLI will introduce conflicts with command options for different commands and other edge cases that need to be handled. This will lead to unwanted complexity and potential bugs.

amir1376 commented 1 month ago

Thanks for the quick response. Then it should to be mentioned in the docs that this key is not processed by the cli tool.

BTW I know about that option. because this configuration file is used by the cli then we expect this behavior! because using -l <lang1> -l <lang2> each time we want to synchronize the translations is a repetitive task task.

One suggestion is that adding another optional root key in the configuration file which accepts default cli options. (which it doesn't add conflicts to the VCS integrations) for example

# default cli_options
"cli_options":{
  "export_languages": [
      "ar","fa","fr"
  ]
}

Imagine some projects does not need all the translations that are available in the crowdin (because they are not ready for some reason). this option could be useful in that case.

Thanks.

andrii-bodnar commented 1 month ago

Then it should to be mentioned in the docs that this key is not processed by the cli tool.

It is located in the Configuration File for VCS Integrations section of the documentation.

Imagine some projects does not need all the translations that are available in the crowdin (because they are not ready for some reason).

In this case, you could use the export options (e.g. --skip-untranslated-files or --export-only-approved).