Coder Social home page Coder Social logo

crowdin / crowdin-cli Goto Github PK

View Code? Open in Web Editor NEW
244.0 30.0 89.0 23.67 MB

A command-line client for the Crowdin API

Home Page: https://crowdin.github.io/crowdin-cli

License: MIT License

Java 97.61% Batchfile 0.09% Shell 0.53% JavaScript 1.30% CSS 0.08% PowerShell 0.06% Dockerfile 0.04% Inno Setup 0.29%
cli client command-line-tool sync localization hacktoberfest

crowdin-cli's Introduction

Crowdin CLI Tweet GitHub Repo stars

Crowdin CLI is a command line tool that allows you to manage and synchronize your localization resources with your Crowdin project. Using CLI, you can:

  • automate the process of updating your source files in your Crowdin project
  • download translations from Crowdin and automatically save them in the correct locations
  • upload all your existing translations to Crowdin in minutes
  • manage your localization resources without leaving the terminal
  • integrate Crowdin CLI with GitHub, GitLab, Jenkins, CircleCI, and other software

It is cross-platform and runs in a terminal on Linux-based and macOS operating systems, or in the command prompt on Windows.

Usage

Visit the documentation for more details.

Seeking Assistance and Contributing

If you find any problems or would like to suggest a feature, please read the How can I contribute section in our contributing guidelines.

License

The Crowdin CLI is licensed under the MIT License. 
See the LICENSE file distributed with this work for additional 
information regarding copyright ownership.

Except as contained in the LICENSE file, the name(s) of the above copyright
holders shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written authorization.

crowdin-cli's People

Contributors

anbraten avatar andrii-bodnar avatar andrulko avatar baddaemon avatar calfaand avatar cmrd-senya avatar danielsutts avatar dependabot[bot] avatar dies avatar dmtr-p avatar epicpkmn11 avatar frombetelgeuse avatar genne23v avatar hakanai avatar ihor-popyk avatar ihorpopyk avatar katerina20 avatar kiatt210 avatar mrandersonn avatar myself5 avatar nazar-1 avatar rohalskyy avatar rx2000 avatar semantic-release-bot avatar sweetdevil144 avatar thc202 avatar vasyl-khomko avatar volodymyr95 avatar yevheniyj avatar yzerk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crowdin-cli's Issues

macOS/iOS. Warning: Downloaded translations do not match current project configuration

Hi.

I'm another one who gets Warning: Downloaded translations do not match current project configuration (as in #69) for my macOS/iOS project.

Crowdin CLI version is 2.0.27
Command: crowdin download --branch my_branch --language zh-CN (w/o language option I have same output with en.lproj for all locales)

Building ZIP archive with the latest translations for 'zh-CN' - skipped
Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.
Extracting: '/fastlane/metadata/macOS/zh-Hans/description.txt'
Extracting: '/fastlane/metadata/macOS/zh-Hans/promotional_text.txt'
Extracting: '/fastlane/metadata/macOS/zh-Hans/release_notes.txt'
Warning: Downloaded translations do not match current project configuration. The following files will be omitted:
 - '/Dependencies/Localizations/Resources/Localizations/Strings/en.lproj/Authorization.strings'
...

crowdin.yml

"preserve_hierarchy": true

files: [
 
 # Fails
 { 
  "source" : "Dependencies/Localizations/Resources/Localizations/Strings/en.lproj/*.strings",
  "translation" : "Dependencies/Localizations/Resources/Localizations/Strings/%osx_locale%.lproj/%original_file_name%",
  "escape_quotes" : 2,
  "languages_mapping" : {
   "osx_locale": {
    "zh-CN" : "zh-Hans",
   },
  },
 },
 
 # Works
 { 
  "source" : "fastlane/metadata/macOS/default/**/*.txt",
  "translation" : "fastlane/metadata/macOS/%locale%/**/%original_file_name%",
  "ignore" : [ # translate only description, promotional_text & release_notes
    "/**/keywords.txt",
    "/**/name.txt",
    "/**/subtitle.txt",
    "/**/marketing_url.txt",
    "/**/privacy_url.txt",
    "/**/support_url.txt",
  ],
  "escape_quotes" : 0,
  "languages_mapping" : {
   "locale": {
    "zh-CN" : "zh-Hans",
   },
  },
 },
]

When I build & DL .zip from the website I have such structure:

my_branch
  - fastlane
    - metadata
      - macOS
        - [locales] 🆗 
zh-CN ❓ 
  - my_branch
    - Dependencies
      - Localizations
        - Resources
          - Localizations
            - Strings
              - en.lproj ⚠️ 

Tried locale for languages_mapping - doesn't work either.
So I don't know who doesn' treat the en.lproj folder correctly: web or CLI.

UPD.
Looks like the problem is with crowdin upload --branch.
On the web in the folder properties Resulting file name when exported: is en.lproj but %osx_locale%.lproj is expected. When I change manually it on the web crowdin download -- branch succeeds.

Tried: to use ..../en.lproj/**/*.strings in the source pattern. Resulting file name when exported: is still en.lproj

[Linux] CLI tries to delete /usr/local/bin on uninstall

When I removed the crowdin-cli (v2.0.24) via sudo apt remove crowdin I received the following warning:

dpkg: warning: while removing crowdin, directory '/usr/local/bin' not empty so not removed

It's good that dpkg did not delete the folder and this just appears as a warning. But a package should never delete the /usr/local/bin folder completely.

ENV variable in addition to alias for crowdin cli v3

We have a wrapper around Crowdin CLI and there's a small issue with migrating to v3. It relies on alias which is not available from bash script.
As a workaround we have to do

shopt -s expand_aliases
source ~/.bashrc

But it doesn't feel clean enough.
What about adding ENV var together with alias, like
export CROWDIN_COMMAND="java -jar /usr/local/bin/crowdin-cli.jar"?

"preserve_hierarchy": true broken since 2.0.13

I'm running crowdin-cli on Windows with following base config:

Command: crowdin -b master --identity tools\\crowdin-cli\\crowdin_identity.yaml upload sources

Base YAML config:

"preserve_hierarchy": true
files:
  - source: /ArchiSteamFarm/Localization/Strings.resx
    translation: /ArchiSteamFarm/Localization/Strings.%locale%.resx
  - source: /ConfigGenerator/Localization/CGStrings.resx
    translation: /ConfigGenerator/Localization/CGStrings.%locale%.resx

(identity config contains only api key and project name)

This works perfectly fine in version 2.0.12, that results in following output:

Creating branch 'master' - SKIPPED
File 'master/ArchiSteamFarm/Localization/Strings.resx' - SKIPPED
File 'master/ConfigGenerator/Localization/CGStrings.resx' - SKIPPED

Updating crowdin-cli to 2.0.13 results in following not intended output for the same command/config:

Creating branch 'master' - SKIPPED
File 'master/Strings.resx' - OK
File 'master/CGStrings.resx' - OK

This is a regression to me, structure is no longer preserved. I tried several tricks such as replacing / with \\, as well as moving my entire structure to JSON but that didn't help. I'll stick with crowdin-cli 2.0.12 until this is fixed.

Thank you in advance.

languages_mapping does not work for sublanguages

For example, if I define mappings for zh-CN and zh-TW, it uses the value I specify for zh-TW for both. This same configuration with v1 of the CLI works correctly. Example config:

"files": [
  {
    "source": "/path/to/messages.properties",
    "translation": "%original_path%/%file_name%_%two_letters_code%.%file_extension%",
    "languages_mapping": {
      "two_letters_code": {
        "zh-CN": "zh_CN",
        "zh-TW": "zh_TW"
      }
    }
  }
]

Is there a way to prevent updating po files if the translations all match?

I have a workflow that involves auto-committing to a repository with the updated files from crowdin.

But po files always get updated with a PO-Revision-Date, even if they didn't get updated:

HearthSim/hsreplaynet-i18n@05dd4d0

So two questions:

  1. Is there a way not to update po files if only the po-revision-date changed?
  2. Why did the po-revision-date change in the first place if no translations were updated? That seems like a bug

Downloaded translations do not match current project configuration

Running crowdin download -b branch-name and get the following output:

Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.
Warning: Downloaded translations do not match current project configuration. The following files will be omitted:
 - '/app/locales/es/translations.json'
 - '/app/locales/fr/translations.json'
 - '/app/locales/it/translations.json'
 - '/app/locales/pt/translations.json'

crowdin.yaml:

# Your crowdin's credentials
#
"project_identifier" : "impact-app"
"api_key_env" : CROWDIN_API_KEY
"base_path" : "."
#"base_url" : ""

#
# Choose file structure in crowdin
# e.g. true or false
#
#"preserve_hierarchy": true

#
# Files configuration
#
files: [
 {
  #
  # Source files filter
  # e.g. "/resources/en/*.json"
  #
  "source" : "/app/locales/en/translations.json",

  #
  # where translations live
  # e.g. "/resources/%two_letters_code%/%original_file_name%"
  #
  "translation" : "/app/locales/%two_letters_code%/%original_file_name%",

  #
  # files or directories for ignore
  # e.g. ["/**/?.txt", "/**/[0-9].txt", "/**/*\?*.txt"]
  #
  #"ignore" : [],

  #
  # The dest allows you to specify a file name on Crowdin
  # e.g. "/messages.json"
  #
  #"dest" : "",

  #
  # File type
  # e.g. "json"
  #
  #"type" : "",

  #
  # The parameter "update_option" is optional. If it is not set, translations for changed strings will be lost. Useful for typo fixes and minor changes in source strings.
  # e.g. "update_as_unapproved" or "update_without_changes"
  #
  #"update_option" : "",

  #
  # Start block only for XML
  #

  #
  # Defines whether to translate tags attributes.
  # e.g. 0 or 1  (Default is 1)
  #
  # "translate_attributes" : 1,

  #
  # Defines whether to translate texts placed inside the tags.
  # e.g. 0 or 1 (Default is 1)
  #
  # "translate_content" : 1,

  #
  # This is an array of strings, where each item is the XPaths to DOM element that should be imported
  # e.g. ["/content/text", "/content/text[@value]"]
  #
  # "translatable_elements" : [],

  #
  # Defines whether to split long texts into smaller text segments.
  # e.g. 0 or 1 (Default is 1)
  #
  # "content_segmentation" : 1,

  #
  # End block only for XML
  #

  #
  # Start .properties block
  #

  #
  # Defines whether single quote should be escaped by another single quote or backslash in exported translations.
  # e.g. 0 or 1 or 2 or 3 (Default is 3)
  # 0 - do not escape single quote;
  # 1 - escape single quote by another single quote;
  # 2 - escape single quote by backslash;
  # 3 - escape single quote by another single quote only in strings containing variables ( {0} ).
  #
  # "escape_quotes" : 3,

  #
  # End .properties block
  #

  #
  # Often software projects have custom names for locale directories. crowdin-cli allows you to map your own languages to be understandable by Crowdin.
  #
  #"languages_mapping" : {
  #  "two_letters_code" : {
  #    "crowdin_language_code" : "local_name"
  #   }
  #},

  #
  # Is first line contains header?
  # e.g. true or false
  #
  #"first_line_contains_header" : true,

  #
  # for spreadsheets
  # e.g. "identifier,source_phrase,context,uk,ru,fr"
  #
  # "scheme" : "",
 }
]

Using v2.0.6

.NET resx files, variables name changed

Hello, I have an issue on .resx files when downloading translations:
I have a variable called like "ServiceStatus_Active.Text", but when downloading translations through CLI, i found in the same file the correct translation, but the variable name changed from "ServiceStatus_Active.Text" to "ServiceStatus_Active".
Obviously this thing is compromising my website translation.
Is it a bug or something I have to fix in settings?

Thank you.

PS: my CLI version is 2.0.22

Error: `base path` is empty

When trying to download the latest translations for my crowdin project, I get the following error:

$ crowdin download --identity keys/crowdin.yaml
Building ZIP archive with the latest translations for 'ro' - skipped
Error `base path` is empty

My config file:

"project_identifier": "[redacted]"
"base_path": "."

files: [
  {
    "source": "/electron/locale/strings.js",
    "translation": "/electron/locale/strings-%two_letters_code%.js",
    "update_option": "update_as_unapproved"
  }
]

My environment:

OS: Linux Debian 9.5 stretch
crowdin: v2.0.24
Java: 1.8.0_191

Translation file does not exist when it contains 'en' in the path

My crowdin.yml file looks like this:

"project_identifier": "..."
"api_key": "..."
"base_path": ""
"preserve_hierarchy": true
files: [
{
  "source": "/**/locale/en/LC_MESSAGES/*.po",
  "translation": "/**/locale/%two_letters_code%/LC_MESSAGES/%original_file_name%",
  "ignore": ["venv/**/*", "node_modules/**/*"],
  "update_option": "update_as_unapproved",
}
]

I have these files:

./core/locale/sv/LC_MESSAGES/django.po
./core/locale/de/LC_MESSAGES/django.po
./core/locale/en/LC_MESSAGES/django.po
./payment/locale/sv/LC_MESSAGES/django.po
./payment/locale/de/LC_MESSAGES/django.po
./payment/locale/en/LC_MESSAGES/django.po

After running: $ crowdin upload translations, I get this output..

Uploading translation file '/core/locale/de/LC_MESSAGES/django.po' - uploaded
Translation file '/Users/sy/project/paymt/en/locale/de/LC_MESSAGES/django.po' does not exist
Uploading translation file '/core/locale/sv/LC_MESSAGES/django.po' - uploaded
Translation file '/Users/sy/project/paymt/en/locale/sv/LC_MESSAGES/django.po' does not exist
Uploading translation file '/core/locale/en/LC_MESSAGES/django.po' - uploaded
Translation file '/Users/sy/project/paymt/en/locale/en/LC_MESSAGES/django.po' does not exist

...

The end result is that the translations files beneath ./payment/ are not uploaded.

BC break with configuration file v1

Hello,

We have been using crowdin and crowdin-cli (v1) for a long time now. I have tried running crowdin-cli-2 but it somehow broke our project.

Running crowdin lint looks OK:

$ crowdin lint
Your configuration file looks to be good

However, the behavior of crowdin upload sources is not what was expected. We ended up with a lot of new files on the project tree (whereas just one file was really new) without respect to the directory hierarchy. It looks like preserve_hierarchy is set to true by default in v1, and false in v2.

I feel like backward compatibility is broken when using crowdin-cli 2 with a v1 config file (that gets validated nonetheless).

Do you have any plan to distinguish between v1/v2 config files - something like a version: 2 key maybe? Or anything else to keep the behavior consistent between the two versions?

Json files miss a new line at end of file

Our standard code formatting requires newlines at end of file. There's no option to tell crowdin to do the same. This results in unnecessary white-space commits or reformatting when stored in a repository.

Please add a setting that controls new line at end of file.

Installation script doesn't run with java > 8 on Linux

Describe the bug
When I try to install crowdin cli v3 on ArchLinux with Java newer than 8, it fails saying Java version is wrong.

To Reproduce
Steps to reproduce the behavior:

  1. Set default java version to 13: sudo archlinux-java set java-13-openjdk
  2. Run installation script: sudo ./install-crowdin-cli.sh

Expected behavior
Installation is successful.

Actual behavior
I receive an error about my Java version:

$ sudo ./install-crowdin-cli.sh 
Checking JAVA installation...
/usr/bin/java
Checking JAVA version...
Your Java version is 13.0.2 - needs to be updated. You can download it from https://www.java.com/
Crowdin CLI not installed!

Environment:

  • OS: ArchLinux
  • Version: rolling release, last updated May 2020

"ignore" does not ignore log4j.properties

Java uses the same extension for string properties files and for other configuration files, so I would like to ignore all the other properties files.

So I tried to do this:

files:
- source: "/**/src/resources/**/*.properties"
  translation: "%original_path%/%file_name%_%two_letters_code%.%file_extension%"
  ignore:
  - "/**/*_*.properties"
  - "/**/build/*"
  - "/**/log4j.properties"
  - "/**/plugin-descriptor.properties"
  - "/**/portable-config.properties"
  type: properties

When I run:

java -jar ~/downloads/2.0.14/crowdin-cli.jar  list project | grep log4j

It shows two files being included which surely match the ignore pattern:

/server/src/resources/config/log4j.properties
/util/src/resources/config/log4j.properties

The other 4 ignore entries work as expected, even though two of them look exactly the same as the log4j.properties ignore. I even scraped for funny Unicode characters, in case something funny was in there, but no, it's all ASCII as far as I can tell, so I don't know why log4j.properties isn't working.

Autodetect current branch

Hello!

Why CLI tool doesn't apply current branch automatically?

It can try to detect VCS type and get the current branch.

For example, git branch | grep -e "^*" | cut -d' ' -f 2.

Localising .strings files for iOS

I've recently started my free trial with Crowdin to see if it would be suitable to use going forward in my iOS apps.
From what I've seen, it seems really useful.
However, I'm having difficulties getting it to work with .strings files, which are the kind of files used for localisations in iOS projects.

This is my configuration for source and translations:

  "source" : "/AppName/en.lproj/Localizable.strings",

  "translation" : "/AppName/%osx_code%/%original_file_name%",

I've tried different formats within the .strings file itself.

Ideally I'd like to define my strings in a key-value format:

"key" = "value"

But neither this or just having a string in or out of quotes works:

"String"
-----
String

The files upload and download absolutely fine using:

crowdin upload sources
-----
crowdin download

The issue is, once the file is on the system, it doesn't pick up any strings in the file to be translated.

screen shot 2017-03-17 at 11 10 59

Apostrophe not processeded by \ on Android

When I download translations with string contains apostrophe ('), Android lint show warning in string.xml

You've earned: {count}

image

Is this possible to put apostrophe automaticaly when I download translations?

Homebrew. Tap

Hi.

Thanks for the quick fix of the #109
But we had to manually override files on our CI cause a brew formula is not updated yet.

Did you ever consider a standalone tap (homebrew-crowdin-cli repo or formula.rb in the current one) for Homebrew installs to deliver updates faster & w/o waiting for the 3rd party PR review?

Thank you.

CLI is phenomenally slow to do anything at all

The CLI was taking about 2 minutes to upload each individual file. We have about 300 files and 11 translations, which would take 300 × 11 × 2 = 6600 minutes, which is around 4.6 days.

So I thought I would run dtruss on the project to see how it's wasting all that time.

What it seems to be doing is calling stat64 on all the properties files over and over.

stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_ar.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_da.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_de.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_es_419.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_fr_CA.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_iw.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_ja.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_ko.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_nl.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_pt_BR.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/nativeviewer/windows/vlc/Bundle_zh_CN.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_ar.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_da.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_de.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_es_419.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_fr_CA.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_iw.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_ja.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_ko.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_nl.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_pt_BR.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/pdf/Bundle_zh_CN.properties\0", 0x700002445390, 0x84D00)		 = 0 0
stat64("/Data/Projects/acme/trunk/product/investigator/src/resources/com/acme/investigator/workbench/items/printpreview/Bundle_ar.properties\0", 0x700002445390, 0x84D00)		 = 0 0

I tried grepping one particular file to figure out how often it is doing this, and it prints about one line per second. So every second, it's stating every file in the directory hierarchy.

I haven't read the code yet, so I can't figure out why it would have to scan the whole directory so many times before uploading just one file every couple of minutes.

ignore seems not to work

I wanted to ignore some files for translation but it seems not to work at all.

I'm using the crowdin command line tool (2.0.17) with the following crowdin.yml-file (without project_identifier etc.):

files: [
 {
  "source" : "\\SDC.Resources\\*.resx",
  "translation" : "\\SDC.Resources\\%file_name%.%two_letters_code%.resx",
  "ignore" : [
    "\\SDC.Resources\\AccountRes.de.resx",
    ],
 },

In the SDC.Resources folder are the source-files (*.resx) as well as the translated files which end with *.de.resx.
I tried many other ignore patterns like

"**\\*.de.resx",
"*.de.resx",
"/*.de.resx",
"**/*.de.resx"

In the end I tried to explicitly ignore one file but even that seems not work.
I'm using the Windows-style directory separator as suggested in the docs for setting the base_path and the source and I assumed to do that also in the ignore-section.

Am I doing something wrong or is there something wrong?

crowdin upload translations does not work for beta version

When I try to upload the translation using

crowdin upload translations

it says:

Translation file '[my project path]/src/common/translations/src/common/translations/fr_FR/i10n.json' does not exist
...

This is my crowdin config:

"project_identifier" : "binary-bot"
api_key_env: CROWDIN_API_KEY

files:
  - 
    source: /src/common/translations/en/i10n.json
    translation: /src/common/translations/%locale_with_underscore%/%original_file_name%

But if I try with the crowdin-cli it works fine:

crowdin-cli upload translations
Uploading translation file `/src/common/translations/ach_UG/i10n.json' - Skipped
Uploading translation file `/src/common/translations/zh_CN/i10n.json' - OK
Uploading translation file `/src/common/translations/zh_TW/i10n.json' - OK
Uploading translation file `/src/common/translations/fr_FR/i10n.json' - OK
...

Translationlinking breaks on upload from different os

Hello,

we are working in a team with different operating systems. Depending which os upload our (the same) source files the translation linking breaks. Looks like its only happening on translations with line breaks.

It would be awesome if you can fix that :)

Best regards

Stefan

Option to not change `PO-Revision-Date` when file hasn't changed

It would be great to be able to disable changing PO-Revision-Date for files that haven't been changed, otherwise each translation update causes all po files to be updated which results in a lot of big commits when you update po files often.

This example commit that has 792 files changed could be reduced to 41 files simply by only editing PO-Revision-Date in po files that actually have been changed:
Cog-Creators/Red-DiscordBot@0913b68

uploading: Error: String index out of range: -1

We're moving from the ruby crowdin-cli to this java crowdin-cli-2 version.
Are any configuration changes needed? Uploading is currently not working for us.
After running java -jar crowdin-cli.jar upload sources I get this error:
Error: String index out of range: -1

This is the configuration:

project_identifier: SOME-IDENTIFIER
api_key: SOME-API-KEY
base_url: https://api.crowdin.com
base_path: .

files:
  -
    source: '/translations/en_GB/**/*.xliff'
    translation: '/translations/%locale_with_underscore%/**/%original_file_name%'

Error code 15 when trying to upload iOS Localizable.strings

Hi!

I am trying to upload my localization files for an iOS project. Upload of the file structure goes correctly, I can see corresponding folders persisted, however as soon as Crowdin tries to upload Localizable.strings file I get this error in my console (I am using Crowdin CLI version is 2.0.22):

$ crowdin upload --identity ./crowdin.credentials.yml
Directory 'MyAppName' - OK
Directory 'MyAppName/Localization' - OK
Directory 'MyAppName/Localization/en.lproj' - OK
File 'MyAppName/Localization/en.lproj/Localizable.strings' - ERROR
code : 15
message : Invalid file type

What am I doing wrong? Could you help me out please?
Here is how my configuration file looks like (it passes the lint command successfully):

"project_identifier" : "MyProjectName"
"base_path" : "."
"preserve_hierarchy": true

files: [
 {
  "source" : "/MyAppName/Localization/en.lproj/Localizable.strings",
  "translation" : "/MyAppName/Localization/%osx_code%/%original_file_name%",
  "type" : "strings",
  "languages_mapping" : {
   "two_letters_code" : {
     "no" : "nb"
    }
  },
 }
]

Use nonzero exit codes when an error happens

I've been having a lot of trouble catching errors related to crowdin-cli in CI because whenever there's an error and it exits, it always uses exit code 0 (success).

For example, crowdin --config does_not_exist.yml upload sources && echo "Success!" will in fact print success.

Capistrano + crowdin download translations error: Nothing written

Hello,

I have a capistrano task that downloads translation files using crowdin cli, and sometimes I got this error that fails the deploy:

#<Thread:0x000055de0a48f970@/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as [email protected]: cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr exit status: 1 (SSHKit::Runner::ExecuteError)
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stdout: Building ZIP archive with the latest translations for 'fr'/
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stderr: Nothing written
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/command.rb:99:in `exit_status=': cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr exit status: 1 (SSHKit::Command::Failed)
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stdout: Building ZIP archive with the latest translations for 'fr'/
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stderr: Nothing written
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/netssh.rb:169:in `execute_command'
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:145:in `block in create_command_and_execute'
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:145:in `tap'
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:145:in `create_command_and_execute'
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:78:in `execute'
	from /srv/lib/capistrano/tasks/crowdin.rake:6:in `block (4 levels) in <top (required)>'
	from /srv/lib/capistrano/tasks/crowdin.rake:5:in `each'
	from /srv/lib/capistrano/tasks/crowdin.rake:5:in `block (3 levels) in <top (required)>'
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:29:in `run'
	from /usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr exit status: 1
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stdout: Building ZIP archive with the latest translations for 'fr'/
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stderr: Nothing written
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'

Caused by:
SSHKit::Command::Failed: cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr exit status: 1
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stdout: Building ZIP archive with the latest translations for 'fr'/
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stderr: Nothing written
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/command.rb:99:in `exit_status='
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/netssh.rb:169:in `execute_command'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:145:in `block in create_command_and_execute'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:145:in `tap'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:145:in `create_command_and_execute'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:78:in `execute'
/srv/lib/capistrano/tasks/crowdin.rake:6:in `block (4 levels) in <top (required)>'
/srv/lib/capistrano/tasks/crowdin.rake:5:in `each'
/srv/lib/capistrano/tasks/crowdin.rake:5:in `block (3 levels) in <top (required)>'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/backends/abstract.rb:29:in `run'
/usr/local/bundle/gems/sshkit-1.18.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => crowdin:pull
The deploy has failed with an error: Exception while executing as [email protected]: cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr exit status: 1
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stdout: Building ZIP archive with the latest translations for 'fr'/
cd /releases/20191004160920 && crowdin download --config app/config/crowdin/crowdin.yml -l fr stderr: Nothing written
** Invoke deploy:failed (first_time)
** Execute deploy:failed


** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:


 DEBUG [3b9acf5e] 	/

 DEBUG [3b9acf5e] 	

 DEBUG [3b9acf5e] 	-

 DEBUG [3b9acf5e] 	

 DEBUG [3b9acf5e] 	\

 DEBUG [3b9acf5e] 	

 DEBUG [3b9acf5e] 	|

 DEBUG [3b9acf5e] 	/

 DEBUG [3b9acf5e] 	-

 DEBUG [3b9acf5e] 	

 DEBUG [3b9acf5e] 	\

 DEBUG [3b9acf5e] 	

 DEBUG [55f74790] 	Building ZIP archive with the latest translations for 'en'

 DEBUG [55f74790] 	-

 DEBUG [55f74790] 	

 DEBUG [3b9acf5e] 	|

 DEBUG [3b9acf5e] 	

 DEBUG [55f74790] 	\

 DEBUG [55f74790] 	

 DEBUG [3b9acf5e] 	/

make: *** [deploy] Erreur 1

It says Building ZIP archive with the latest translations for 'fr' Nothing written. When I build project from crowdin management interface, and re-run the deploy job, it succeeds. I don't know what is the problem.

By the way, I can't manage to have this error on my computer (ubuntu 18.04 / Docker), and the config is okey.

Add uninstallation script

There is an installation script for crowdin cli 3, but I'd prefer to have an uninstallation script too. I'd like to have a simple way of removing what have been added by the installation script.

"Warning: Downloaded translations do not match current project configuration" when using `language_mappings` and `osx_code`

Client version: 2.0.20

Issue:

I'm currently having issues trying to pull translations for the following locales to update my .strings file in an Xcode project.

Languages that failed to pull:

  • zn-Hant
  • zn-Hans
  • es
  • pt-BR

Here is part of our yaml that describes how we want to translate those languages into the project. I've tried a few variants on the osx_codemapping, including "es-ES.lproj" : "es.lproj" and "es-ES" : "es". I'm not entirely sure which one is supposed to work, but I ran curl https://api.crowdin.com/api/supported-languages to try and match the supported languages:

"files": [
    {
        "source" : "/Project/Localization/en.lproj/Localizable.strings",
        "translation" : "/Project/Localization/%osx_code%/%original_file_name%",
        "dest" : "Localizable.strings",
        "languages_mapping" : {
            "osx_code" : {
                "es-ES" : "es.lproj",
                "de"    : "de.lproj",
                "pt-BR" : "pt.lproj",
                "it"    : "it.lproj",
                "ja"    : "ja.lproj",
                "zh-CN" : "zh-Hans.lproj",
                "zh-TW" : "zh-Hant.lproj"
            }
        }
    },
    ...
]

The following error returns:

[14:05:12]: ▸ Building ZIP archive with the latest translations for 'es-ES' - skipped
[14:05:12]: ▸ Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.
[14:05:13]: ▸ Warning: Downloaded translations do not match current project configuration. The following files will be omitted:
[14:05:13]: ▸ - '/Project/Localization/es.lproj/InfoPlist.strings'
[14:05:13]: ▸ - '/Project/Localization/es.lproj/Localizable.strings'
[14:05:18]: ▸ Building ZIP archive with the latest translations for 'zh-CN' - skipped
[14:05:18]: ▸ Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.
[14:05:20]: ▸ Warning: Downloaded translations do not match current project configuration. The following files will be omitted:
[14:05:20]: ▸ - '/Project/Localization/zh-Hans.lproj/InfoPlist.strings'
[14:05:20]: ▸ - '/Project/Localization/zh-Hans.lproj/Localizable.strings'
[14:05:20]: ▸ Building ZIP archive with the latest translations for 'zh-TW' - skipped
[14:05:20]: ▸ Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.
[14:05:21]: ▸ Warning: Downloaded translations do not match current project configuration. The following files will be omitted:
[14:05:21]: ▸ - '/Project/Localization/zh-Hant.lproj/InfoPlist.strings'
[14:05:21]: ▸ - '/Project/Localization/zh-Hant.lproj/Localizable.strings'
[14:05:21]: ▸ Building ZIP archive with the latest translations for 'pt-BR' - skipped
[14:05:21]: ▸ Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.
[14:05:22]: ▸ Warning: Downloaded translations do not match current project configuration. The following files will be omitted:
[14:05:22]: ▸ - '/Project/Localization/pt-BR.lproj/InfoPlist.strings'
[14:05:22]: ▸ - '/Project/Localization/pt-BR.lproj/Localizable.strings'

Is there something that needs to be done on the web client, or is there a bug with the client for not parsing osx_code mappings correctly? I am using version 2.0.20 of the client, and the command being run is java -jar crowdin-cli.jar -c crowdin.yml <command>

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

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
  }
]

FileType detection while uploading is based upon first dot?

Hi,
We tried to migrate from the ruby CLI to the java one, and stubbled upon a potential falsy filetype detection
Scenario:

Setting up crowdin (2.0-13) ...
File 'messages.po'-�\�|� - OK
File 'users-auth-create-reset.text.txt'/�-� - ERROR
code : 7
message : Invalid file extension. Allowed are: *.txt

More details : https://circleci.com/gh/CoderDojo/cp-zen-platform/1025
Crowdin.yaml : https://github.com/CoderDojo/cp-translations/blob/master/crowdin.yaml
cc @DanielBrierton

support tcp keepalives

(this is repost of #58 where we discovered this issue. That code doesn't seem to be supported so reopening here as requested since this codebase doesn't seem to support keepalives as far as I can tell)

When trying to download a large project that creates a new export, a request can take a long time (in the case that I am seeing ~60 minutes). When this happens, the cli client keeps the connection open and expects it to remain intact while idle.

This doesn't work behind a lot of firewalls or NAT gateways that have idle connection time limits (AWS NAT Gateway specifically has a 5 min limit and is the one that triggered this issue for us). When this happens and the connection is drop'ed in the middle without a corresponding RST being sent (which is a separate kind of wrong) the client thinks the connection is still up and waits patiently forever to hear back from the remote.

Please support TCP keepalives for http connections in order to avoid this issue. When inspecting the TCP socket the keepalive flag is not added. For the short term we were able to work around the issue with https://github.com/flonatel/libdontdie

Missing -c shorthand

When migrating from v1 to new v2 the shorthand option -c for configuration is missing if you are used to v1 cli. It would be cool to have either the -c shorthand option again or warn the user when an unknown options is passed.

Or is there a specific reason why leaving -c out in v2?

I can also try to do a PR.

Update link gives 404

Version 2.0.20 of the CLI client is available. You can download new version following the link: https://crowdin.com/downloads/crowdin-cli.zip

wget https://crowdin.com/downloads/crowdin-cli.zip
--2017-12-04 04:31:03--  https://crowdin.com/downloads/crowdin-cli.zip
Resolving crowdin.com (crowdin.com)... 107.23.68.151, 52.87.22.90
Connecting to crowdin.com (crowdin.com)|107.23.68.151|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-12-04 04:31:04 ERROR 404: Not Found.

Ignore filter not being applied to translations on upload

We have the following configuration file, working with github sync:

files:
  - source: /docs/src/**/*.md
    ignore:
      - /**/%file_name%-%two_letters_code%.md
      - /docs/src/pages/getting-started/page-layout-examples/**/*
      - /docs/src/pages/premium-themes/**/*
    translation: /%original_path%/%file_name%-%two_letters_code%.%file_extension%
  - source: /docs/translations/*.json
    ignore:
      - /**/%file_name%-%two_letters_code%.json
    translation: /%original_path%/%file_name%-%two_letters_code%.%file_extension%

(Original: https://github.com/mui-org/material-ui/blob/next/crowdin.yml)

However, on running crowdin upload --dryrun while in the project root directory, it indicates that it would upload all files, including translations:

src/modules/components/backers-de.md
src/modules/components/backers-es.md
src/modules/components/backers-fr.md
src/modules/components/backers-ja.md
src/modules/components/backers-pt.md
src/modules/components/backers-ru.md
src/modules/components/backers-zh.md
src/modules/components/backers.md
src/pages/css-in-js/advanced/advanced-de.md
src/pages/css-in-js/advanced/advanced-es.md
src/pages/css-in-js/advanced/advanced-fr.md
src/pages/css-in-js/advanced/advanced-ja.md
src/pages/css-in-js/advanced/advanced-pt.md
src/pages/css-in-js/advanced/advanced-ru.md
src/pages/css-in-js/advanced/advanced-zh.md
src/pages/css-in-js/advanced/advanced.md
[etc...]

In addition, as well as wanting to upload the translations, it appears to want to upload all source files new, changed and existing, rather than just new or changed files.

Thanks.

"UnsupportedOperationException" during upload Android file

Environment

-- Java -- :
openjdk 12 2019-03-19
OpenJDK Runtime Environment (build 12+33)
OpenJDK 64-Bit Server VM (build 12+33, mixed mode, sharing)

-- OS -- :
System Version: macOS 10.14.3 (18D109)
Kernel Version: Darwin 18.2.0

-- CLI -- :
crowdin: stable 2.0.28

Reproduce

$ crowdin upload sources --config crowdin.yml 
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
Exception in thread "main" java.lang.ExceptionInInitializerError
       at com.crowdin.cli.commands.Commands.initCli(Commands.java:858)
       at com.crowdin.cli.commands.Commands.initialize(Commands.java:128)
       at com.crowdin.cli.commands.Commands.run(Commands.java:232)
       at com.crowdin.cli.Cli.main(Cli.java:17)
Caused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.
       at org.apache.logging.log4j.LogManager.callerClass(LogManager.java:555)
       at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:580)
       at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:567)
       at com.crowdin.client.CrowdinApiClientImpl.<clinit>(CrowdinApiClientImpl.java:22)
       ... 4 more

Update

It's seems to be issue of compatibility with my java version. I got it working with

java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

As I prefer to use the latest SDK system wide, i'm using jenv to set the java version inside the folder where I use crowdin.

crowdin upload initialization failure on Ubuntu 18.04

It shows an error

"Initialization Crowdin Cli failed. Please check your configuration file and credentials."

when I run

crowdin upload -b test

crowdin.yml

"project_identifier" : MY_PROJECT
"api_key" : MY_API_KEY
"base_path" : ""

files: [
 {
  "source" : "/src/i18n/en.json",
  "translation" : "/src/i18n/%two_letters_code%.json"
 }
]

OS

Ubuntu 18.04 LTS (Bionic Beaver)

crowdin --version

Crowdin CLI version is 2.0.22

java -version

openjdk 10.0.1 2018-04-17
OpenJDK Runtime Environment (build 10.0.1+10-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 10.0.1+10-Ubuntu-3ubuntu1, mixed mode)

Very slow on multiple files

We have a project with about 140 translation files; we generate one per page and one per UI component.

Both the Ruby tool and this one are very slow for this use case. We see about 2-3 seconds per file which makes this part of our build take nearly 6 minutes, making it the slowest part of our build.

The older Ruby version took about 3 minutes, which is still slow but not so painful.

Could these be uploaded in parallel or pipelined as to not be so slow?

Mapping android_code

let say i have this mapping

"files": [
  {
    "source": "/modules/common/src/main/res/values/strings.xml",
    "translation": "/modules/common/src/main/res/values-%android_code%/%original_file_name%",
    "languages_mapping": {
      "android_code": {
        "az": "az",
        "es-ES": "es",
        "zh-CN": "zh-rCN",
      }
    }
  }
]

CROWDIN v1
command: crowdin-cli list translations
gives output:
/modules/common/src/main/res/values-az/strings.xml
/modules/common/src/main/res/values-es/strings.xml
/modules/common/src/main/res/values-zh-rCN/strings.xml

CROWDIN v2
command: crowdin list translations
gives output:
/modules/common/src/main/res/values-az-rAZ/strings.xml
/modules/common/src/main/res/values-es/strings.xml
/modules/common/src/main/res/values-zh-rCN/strings.xml

v1 had correct behaviour, is this bug or is there any way v2 give same output as v1

CLI leaves a mess behind from time to time

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        bg.zip
        de.zip
        el.zip

I have no clue under what conditions those files are popping up, but it seems that even after successful CLI run, one can find temporary zip files with updated translation lying around not being deleted.

This is not easily reproducable bug, I couldn't reproduce it with already pre-built translations. CLI version 2.0.14, I've just updated to latest 2.0.15, but I didn't see any commit mentioning this problem.

Thank you in advance.

** wildcards unexpected behavior

"api_key_env": CROWDIN_API_KEY
"project_identifier": "kdeorg"

files: [
 {
  "source" : "/templates/**/*.pot",
  "translation" : "/%locale_with_underscore%/**/%file_name%.po",
 }
]

For example, the source file is template/messages/kde-workspace/user_manager.pot and the translation file is zh_CN/messages/kde-workspace/user_manager.po.

But when I upload translation, I got this error:

Translation file '/home/sign/git/kde/kde-cn/stable/zh_CN/messages/kde-workspace/user_manager.pot/user_manager.po' does not exist

It seems ** is matching both folders and original file names. But from Crowdin document, it should only match folder.

macOS: -bash: clearalias: command not found

I'm following the instructions for installation the Crowdin command and getting the following error:

-bash: clearalias: command not found

Full output:

Richards-Mac-mini:2.0.30 richard$ sudo sh crowdin.sh
/usr/bin/java
Your Java version is 12.0.1 - OK
Identity added: /Users/richard/.ssh/id_rsa ([email protected])
/Users/richard/.bash_profile: line 14: clearalias: command not found
Richards-Mac-mini:2.0.30 richard$ 

What could go wrong and how to fix it?

setup_crowdin.bat should navigate to script path before calling %cd%

It's not guaranteed for the script to be started from its own directory. This is even more true when we start script as administrator, as in this case %cd% almost always evaluates to C:\Windows\system32.

@echo off
SETLOCAL
SET TEMPFILE=%TEMP%\tmpfile

setx /M CROWDIN_HOME "%cd%"
setx /M PATH "%PATH%;%cd%"
...

Should be:

@echo off
SETLOCAL
SET TEMPFILE=%TEMP%\tmpfile

pushd %~dp0
setx /M CROWDIN_HOME "%cd%"
setx /M PATH "%PATH%;%cd%"
...

Otherwise we might be setting PATH and CROWDIN_HOME into totally wrong location, such as C:\Windows\system32, as there is no check that verifies if crowdin binary even exists in that location in the first place.

Thanks for considering this small enhancement. I'd send a PR but I don't see this file anywhere.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.