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

download sources doesn't handle configuration files with ** wildcards in source when dest is configured #519

Closed
rbioteau opened this issue Dec 21, 2022 · 5 comments · Fixed by #538

Comments

@rbioteau
Copy link

Describe the bug

When using a ** wildcardis used in a source property of a file object in the configuration in addition to a dest property, the download source command does not find source files and display the following warning message:

⚠️  No sources found for '/folder_on_crowdin/%original_path%/%file_name%.properties' pattern. Check the source paths in your configuration file

To Reproduce
Steps to reproduce the behavior:

  1. Configuration file:
"base_path": "."
"preserve_hierarchy": true

"files": [
    {
    "source": "folder1/folder2/**/messages.properties",
    "dest" : "/folder_on_crowdin/%original_path%/%file_name%.properties",
    "translation": "folder1/folder2/**/%file_name%_%two_letters_code%.properties"
   }
]
  1. Execute CLI command:
crowdin download sources -b <branch> -i <projectId> -T <api_token>
  1. See an error
⚠️  No sources found for '/folder_on_crowdin/%original_path%/%file_name%.properties' pattern. Check the source paths in your configuration file

Expected behavior
Source files should be found and downloaded.

Environment:

  • OS: Ubuntu
  • Version 20.04

Additional context

I found a painful workaround by removing the ** wildcard and explicit all my path in the configuration file.

"base_path": "."
"preserve_hierarchy": true

"files": [
    {
    "source": "folder1/folder2/folder3/folder4/messages.properties",
    "dest" : "/folder_on_crowdin/folder1/folder2/folder3/folder4/%file_name%.properties",
    "translation": "folder1/folder2/folder3/folder4/%file_name%_%two_letters_code%.properties"
   }
]

In my use case, it requires having 90+ file objects in my configuration.

@rbioteau
Copy link
Author

After testing the new version (3.11) it doesn't behave as expected (ant style pattern matcher ?) in the following use case:

"base_path": "."
"preserve_hierarchy": true

"files": [
    {
    "source": "folder1/folder2/**/messages.properties",
    "dest" : "/folder_on_crowdin/%original_path%/%file_name%.properties",
    "translation": "folder1/folder2/**/%file_name%_%two_letters_code%.properties"
   },
  {
    "source": "folder1/folder2/**/plugin.properties",
    "dest" : "/folder_on_crowdin/%original_path%/%file_name%.properties",
    "translation": "folder1/folder2/**/%file_name%_%two_letters_code%.properties"
   }
]

When downloading sources, a plugin.properties file is created with the content of the messages.properties file and
messages.properties content is replaced with plugin.properties content.

@andrii-bodnar
Copy link
Member

andrii-bodnar commented Apr 25, 2023

@rbioteau I just tested your configuration and can confirm that there is an issue with the sources download in this case. As a workaround, I would recommend adjusting your configuration to a single file group:

"base_path": "."
"preserve_hierarchy": true

"files": [
  {
    "source": "folder1/folder2/**/*.properties",
    "dest" : "/folder_on_crowdin/%original_path%/%file_name%.properties",
    "translation": "folder1/folder2/**/%file_name%_%two_letters_code%.properties"
  }
]

@rbioteau
Copy link
Author

@andrii-bodnar Thanks for the tips !

However, it won't work for my use case as it will include all sort of properties files like localized messages_<locale>.properties and other properties files that has nothing to do with crowdin and l10n.

@andrii-bodnar
Copy link
Member

#574

@andrii-bodnar
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants