question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uploading files with the new CLI tool ignores "dest" parameter

See original GitHub issue

Using the old tool on another computer it uploads files correctly to subfolders, while the new tool just puts them in the root folder of my crowdin project.

Old tool:

Updating source file `sdmaid/strings.xml' - OK
Updating source file `unlocker/strings.xml' - Skipped
Updating source file `sdmaid/description.txt' - OK
Updating source file `sdmaid/title.txt' - Skipped
Updating source file `sdmaid/short_description.txt' - Skipped
Updating source file `unlocker/description.txt' - Skipped
Updating source file `unlocker/title.txt' - Skipped
Updating source file `unlocker/short_description.txt' - Skipped

New tool:

File '/strings.xml' - OK
File '/strings.xml' - OK
File '/description.txt' - OK
File '/title.txt' - OK
File '/short_description.txt' - OK
File '/description.txt' - OK
File '/title.txt' - OK
File '/short_description.txt' - OK

Config

"project_identifier" : "sdmaid"

"files" : [
  {
    "source" : "/sdmaid/src/main/res/values/strings.xml",
    "dest" : "/sdmaid/strings.xml",
    "translation" : "/sdmaid/src/main/res/values-%android_code%/%original_file_name%",
#    "update_option" : "update_as_unapproved",
    "languages_mapping" : &stringmapping {
      "android_code" : {
        "ar" : "ar",
        "am" : "am",
        "hy-AM" : "hy-rAM",
        "az" : "az",
        "be" : "be",
        "bn" : "bn-rBD",
        "bg" : "bg",
        "ca" : "ca",
        "cs" : "cs",
        "da" : "da",
        "de" : "de",
        "el" : "el",
        "es-ES" : "es",
        "es-AR" : "es-rAR",
        "es-MX" : "es-rMX",
        "es-VE" : "es-rVE",
        "et" : "et-rEE",
        "eu" : "eu-rES",
        "fa" : "fa",
        "fil" : "fil",
        "fi" : "fi",
        "fr" : "fr",
        "gl" : "gl-rES",
        "hr" : "hr",
        "hu" : "hu",
        "hy-AM" : "hy-rAM",
        "is" : "is",
        "id" : "in",
        "it" : "it",
        "he" : "iw",
        "ja" : "ja",
        "ka" : "ka-rGE",
        "km" : "km-rKH",
        "kn" : "kn-rIN",
        "ko" : "ko",
        "ky" : "ky-rKG",
        "lt" : "lt",
        "lv" : "lv",
        "lo" : "lo-rLA",
        "ms" : "ms",
        "ml-IN" : "ml-rIN",
        "mn" : "mn-rMN",
        "mr" : "mr-rIN",
        "my" : "my-rMM",
        "ne-NP" : "ne-rNP",
        "nl" : "nl",
        "no" : "no",
        "pl" : "pl",
        "pt-PT" : "pt",
        "pt-BR" : "pt-rBR",
        "ro" : "ro",
        "ru" : "ru",
        "rm-CH" : "rm",
        "si-LK" : "si-rLK",
        "sk" : "sk",
        "sl" : "sl",
        "sr" : "sr",
        "sv-SE" : "sv",
        "sw" : "sw",
        "th" : "th",
        "ta" : "ta-rIN",
        "te" : "te-rIN",
        "tr" : "tr",
        "uk" : "uk",
        "ur-IN" : "ur-rIN",
        "uz" : "uz",
        "vi" : "vi",
        "zh-CN" : "zh-rCN",
        "zh-HK" : "zh-rHK",
        "zh-TW" : "zh-rTW",
        "zu" : "zu"
      }
    }
  }, {
    "source" : "/unlocker/src/main/res/values/strings.xml",
    "dest" : "/unlocker/strings.xml",
    "translation" : "/unlocker/src/main/res/values-%android_code%/%original_file_name%",
#    "update_option" : "update_without_changes",
    "languages_mapping" : *stringmapping
  }, {
    "source" : "/sdmaid/fastlane/metadata/android/en-US/full_description.txt",
    "dest" : "/sdmaid/description.txt",
    "translation" : "/sdmaid/fastlane/metadata/android/%locale%/full_description.txt",
#    "update_option" : "update_without_changes",
    "languages_mapping" : &playstoremapping {
      "locale" : {
        "af" : "af",
        "ar" : "ar",
        "am" : "am",
        "hy-AM" : "hy-AM",
        "az" : "az-AZ",
        "be" : "be",
        "bn" : "bn-BD",
        "bg" : "bg",
        "ca" : "ca",
        "cs" : "cs-CZ",
        "da" : "da-DK",
        "de" : "de-DE",
        "el" : "el-GR",
        "es-ES" : "es-ES",
        "es-AR" : "es-AR",
        "es-MX" : "es-419",
        "es-VE" : "es-VE",
        "et" : "et",
        "eu" : "eu-ES",
        "fa" : "fa",
        "fil" : "fil",
        "fi" : "fi-FI",
        "fr" : "fr-FR",
        "fr-CA" : "fr-CA",
        "gl" : "gl-ES",
        "hr" : "hr",
        "hu" : "hu-HU",
        "hy-AM" : "hy-AM",
        "is" : "is-IS",
        "id" : "id",
        "it" : "it-IT",
        "he" : "iw-IL",
        "hi" : "hi-IN",
        "ja" : "ja-JP",
        "ka" : "ka-GE",
        "km" : "km-KH",
        "kn" : "kn-IN",
        "ko" : "ko-KR",
        "ky" : "ky-KG",
        "lt" : "lt",
        "lv" : "lv",
        "lo" : "lo-LA",
        "mk" : "mk-MK",
        "ms" : "ms",
        "ml-IN" : "ml-IN",
        "mn" : "mn-MN",
        "mr" : "mr-IN",
        "my" : "my-MM",
        "ne-NP" : "ne-NP",
        "nl" : "nl-NL",
        "no" : "no-NO",
        "pl" : "pl-PL",
        "pt-PT" : "pt-PT",
        "pt-BR" : "pt-BR",
        "ro" : "ro",
        "ru" : "ru-RU",
        "rm-CH" : "rm",
        "si-LK" : "si-LK",
        "sk" : "sk",
        "sl" : "sl",
        "sr" : "sr",
        "sv-SE" : "sv-SE",
        "sw" : "sw",
        "th" : "th",
        "ta" : "ta-IN",
        "te" : "te-IN",
        "tr" : "tr-TR",
        "uk" : "uk",
        "ur-IN" : "ur-IN",
        "uz" : "uz",
        "vi" : "vi",
        "zh-CN" : "zh-CN",
        "zh-HK" : "zh-HK",
        "zh-TW" : "zh-TW",
        "zu" : "zu"
      }
    }
  }, {
     "source" : "/sdmaid/fastlane/metadata/android/en-US/title.txt",
     "dest" : "/sdmaid/title.txt",
     "translation" : "/sdmaid/fastlane/metadata/android/%locale%/title.txt",
#    "update_option" : "update_without_changes",
     "languages_mapping" : *playstoremapping
  }, {
     "source" : "/sdmaid/fastlane/metadata/android/en-US/short_description.txt",
     "dest" : "/sdmaid/short_description.txt",
     "translation" : "/sdmaid/fastlane/metadata/android/%locale%/short_description.txt",
#    "update_option" : "update_without_changes",
     "languages_mapping" : *playstoremapping
  }, {
     "source" : "/unlocker/fastlane/metadata/android/en-US/full_description.txt",
     "dest" : "/unlocker/description.txt",
     "translation" : "/unlocker/fastlane/metadata/android/%locale%/full_description.txt",
#    "update_option" : "update_without_changes",
     "languages_mapping" : *playstoremapping
  }, {
     "source" : "/unlocker/fastlane/metadata/android/en-US/title.txt",
     "dest" : "/unlocker/title.txt",
     "translation" : "/unlocker/fastlane/metadata/android/%locale%/title.txt",
#    "update_option" : "update_without_changes",
     "languages_mapping" : *playstoremapping
  }, {
     "source" : "/unlocker/fastlane/metadata/android/en-US/short_description.txt",
     "dest" : "/unlocker/short_description.txt",
     "translation" : "/unlocker/fastlane/metadata/android/%locale%/short_description.txt",
#    "update_option" : "update_without_changes",
     "languages_mapping" : *playstoremapping
  }
]

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
d4rkencommented, Mar 15, 2017

I envision it like this

  • Case1, No preserve, no dest. Crowdin optimizes the pathes on their server.
  • Case2, Preserve=true, no dest. Crowdin replicates the local path on their server.
  • Case3a, Preserve=true, dest set. Crowdin uses the path from dest on their server.
  • Case3b, Preserve=false, dest set. Crowdin uses the path from dest on their server.

Which would be 3 cases for path handling:

  • Automatic (optimized)
  • Disabled (preserved)
  • Manual (dest)

I think dest should override preserve_hierarchy this would be less confusing and is then actually the same behavior from CLI 1.0, so the same config files can then be used.

https://github.com/crowdin/crowdin-cli#preserving-directories-hierarchy https://support.crowdin.com/configuration-file/#saving-directory-structure-on-server

https://github.com/crowdin/crowdin-cli-2/issues/23#issuecomment-281338325

1reaction
d4rkencommented, Mar 15, 2017

Now it works 👍 . I still don’t understand why preserve_hierarchy is necessary when specifying dest.

Please check https://support.crowdin.com/configuration-file/#saving-directory-structure-on-server it and https://support.crowdin.com/configuration-file/#uploading-files-to-specified-path-with-specified-type

It’s just not clear (at least to me) why preserve_hierarchy is required. Especially because documentation makes it seem that dest allows specifying a file path and that example doesn’t have preserve_hierarchy either. From the documentation I would thought that preserve_hierarchy affects the path only when multiple files have the same common parent folders, which are then omitted for a cleaner structure and this wouldn’t affect my case.

    "source" : "/sdmaid/src/main/res/values/strings.xml",
    "dest" : "/sdmaid/strings.xml",
    "source" : "/unlocker/src/main/res/values/strings.xml",
    "dest" : "/unlocker/strings.xml",

don’t share a common directory. But if this really is the desired behavior for for dest and preserve_hierarchy then CLI tool should abort the upload process if it detects that multiple files from the same upload will overwrite each other, as this is very likely with the way it currently behaves.

I would propose to add a check for files from the same upload overwritting each other and to make dest work independent of preserve_hierarchy. Meaning if dest is set, then preserve_hierarchy is automatically set to true. At least I don’t see a case which requires dest to be set but preserve_hierarchy to be false, do you?

It also is weird that it is not skipping all files, because there was nothing changed in them. But it’s likely not related to this bug. Maybe some windows/linux/mac \n\t\r issue? Are normalizing the input, i.e. like in git?

Connected to the target VM, address: '127.0.0.1:60244', transport: 'socket'
File 'sdmaid/strings.xml'-
 - SKIPPED
File 'unlocker/strings.xml' - OK
File 'sdmaid/description.txt' - OK
File 'sdmaid/title.txt'\
 - SKIPPED
File 'sdmaid/short_description.txt' - SKIPPED
File 'unlocker/description.txt' - OK
File 'unlocker/title.txt' - SKIPPED
File 'unlocker/short_description.txt' - SKIPPED
Disconnected from the target VM, address: '127.0.0.1:60244', transport: 'socket'
Read more comments on GitHub >

github_iconTop Results From Across the Web

HubSpot CLI commands
The HubSpot CLI connects your local development tools to HubSpot, allowing you to ... Upload a new local asset to your HubSpot account....
Read more >
Document command-line syntax - Google Developers
Key Point: Recommendations for documenting command-line tools. This page shows how to document command-line commands and their arguments.
Read more >
sync — AWS CLI 1.27.32 Command Reference
Recursively copies new and updated files from the source directory to the destination. Only creates folders in the destination if they contain one...
Read more >
Configuration File | Crowdin Developer Portal
Uploading Files to Specified Path with Specified Type​​ The dest parameter allows you to specify a file name in Crowdin. It works for...
Read more >
Nexus IQ CLI - Sonatype Help
Using the Nexus IQ CLI. Select the application to evaluate from onboarded IQ server applications. application-id is an input parameter used to specify...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found