Giter Club home page Giter Club logo

crowdin-cli-v1's People

Contributors

andrulko avatar ihorpopyk avatar lasfin avatar mamantoha avatar mikeng avatar royd avatar strml avatar therbom avatar tmo-trustpilot avatar vslavik avatar webromik avatar wolf777 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

Watchers

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

crowdin-cli-v1's Issues

How to deal with translation-files that have the locale in the filename?

Hi!

Unfortunately we dont have a

translations/
    en/somefile.xlf
    de/somefile.xlf

structure, but instead we have the locale on the filenames, like this:

translations/
    somefile.en.xlf
    somefile.de.xlf

Is there any way how i can configure source and translation on the corwdin.yaml so this will work?

Ability to specify a base_path that contains branch subfolders.

In CyanogenMod we usually have a common base_path (/android) that contains subfolders of each version. (/android/cm-12.1, ~/android/cm-13.0, etc.)

It would be very useful to have support for a common base_path using the new branch feature in crowdin, so we don't have to specify a different base_path for each CyanogenMod version (we use different yaml configs for different versions, as the packages are different)

I think this was already implemented but commented out in crowdin-cli if I understand right. I will try to make it an option, if it works I'm going to make a pull request.

"crowdin-cli upload sources" does not work for csv files

I have a source file that is a .csv file. The .yaml config for that source file is:

source: '/fastlane/metadata/**/en-US/*.csv'
translation: '/fastlane/metadata/**/%two_letters_code%/%original_file_name%'
first_line_contains_header: false
scheme: "identifier,source_or_translation"

Updating the file manually in the web interface works correctly, so the file is valid. However, when using the command crowdin-cli upload sources, there is a problem. The file seems to be uploaded correctly - there is no error message. However, when I go to the website and look at the file (that did previously have a string in it) it is now empty - the history on the file says that 1 string was deleted, and it has the text 'Nothing to translate' in the website's file browser.

User specific crowdin.yaml doesn't support base_path

As in #15, using an absolute path as base_path is not the correct solution. I guess it's easy to add support for base_path in the user-specific yaml file, like we can currently do with api_key.

This is needed for our project (CyanogenMod) since a lot of people use the script checked out in different locations.

Using locale or two letter code based on project

I have a project in Crowdin that's being translated into French (fr), Spanish Mexico (es-MX), and Spanish Spain (es-ES). I'm running into an issue where if I defined my configuration to use %locale% the translations for French have fr-FR in the name (which causes C# to fallback if the locale is fr-CA for example) but if I use %two_letters_code% I only get files with es in the name. If I manually download the files they have the correct codes (fr, es-MX, and es-ES).

Is there anyway to setup my configuration so my files download using either the two letter code or the full locale based on the project?

Download command should create directories and folder when they does not exist

Use case :
I add a new translation language from Crowdin website, and do the translations. When a developer use the crowdin-cli download, the new language folder won't exist yet, and the command won't create folders / files associated. It should be the case to simplify workflow and avoid developer to create a multitude of files / folders to match the new locale.

Support mask for 'dest' in config file.

Example:

files:
  -
    source: '/path/to/*.properties'
    translation: '/path/%two_letters_code%/%two_letters_code%'
// 
    dest: '/path/in/crowdin/*.properties'
// or
    dest: '/path/in/crowdin/%original_file_name%'

Pluralized strings removed in chinese translations

Hey,
When I download translations from my crowdin project using crowdin-cli, pluralized keys used by rails-18n are missing, resulting in a tree like this:

users:
   one: "1 user" # this one is missing
   other: "%{count} users"

This is an issue because rails-i18n can't fallback on 'other'. I'm using preverse_hierarchy: true.
It may be nice to be able to replicate 'other' values as 'one' to avoid breakages.

Android code mapping

We are using crowdin.yaml file with crowdin-cli for automated upload and download of translations.
file looks something like this:

files:
  -
    source: /res/values/strings.xml
    translation: /res/values-%android_code%/%original_file_name%
    languages_mapping:
      android_code:
      de-rDE: de
      es-rES: es

and as result we get all translation in folders like :

values-de-rDe
values-es-rES
values-fr-rFR

is there any mapping or some other way to get translations in folders like

values-de
values-es
values-fr-rFR

Error when downloading translations

I was using the latest version of crowdin-cli (at commit a8d20c1) and I encountered this error message:

Extracting: `/packages/apps/Settings/res/values-ro-rRO/arrays.xml'
error: can't convert Zip::Entry into String
Failed to run cmd: crowdin-cli --config=crowdin/crowdin.yaml download -b branch

The error message was resolved once I reverted f687e31. I believe that this should be a simple fix, however since I have 0 experience with Ruby, so this is the most I can help with. Thank you.

API Credentials from environment variables

In our application we use environment variables for storing sensitive credentials.

It would be great if the crowdin.yaml file could support ERB so that we could load the API key from an environment variable, e.g.

api_key: <%= ENV["CROWDIN_API_KEY"] %>

Is it possible to update source string without loosing translation?

Is it possible change a source string and upload it without loosing the translations?

I'm using an Android project where one source string, in english, has a mistake. I believe that changing the source and uploading to CrowdIn (I use the crowdin-cli upload sources command), all translations will be lost for that string. Is that correct ?

"Source String/Translation" csv scheme column type not documented

I have a csv file to upload using the command line that has 2 columns - "Identifier (Key)" and "Source String/Translation". In the documentation of the config file's csv scheme field there is no mention of how to specify the source/translation column type. If you dont specify it correctly in the config file you will get an error when running crowdin-cli upload sources:

"File schema must include the "Source String" and "Translation" options."

For those that are also getting this error and stumped by the documentation, I found the solution:
source_or_translation

I found it by using the browser's developer tools, and watching network activity when saving a template on the crowdin website.

support tcp keepalives

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

It looks like the HTTP handling comes from rest-client, which has a few keepalive patches that are not merged but currently no support for this feature.

Language mapping not working

It used to work, I'm not sure what changed since. My yaml file (iOS project):

project_identifier: REDACTED
api_key: REDACTED
base_path: .
files:
- source: "/Resources/en.lproj/*"
  translation: "/Resources/%osx_code%/%original_file_name%"
  languages_mapping:
    osx_code:
      es-MX: es.lproj
      pt-BR: pt.lproj
      zh-CN: zh-Hans.lproj
      zh-TW: zh-Hant.lproj

My files on crowdin are set to be exported following this format: /Resources/%osx_code%/%original_file_name%

All languages without mapping (like en) are put in their correct place. Languages with mapping (like es-MX) are not. I get an error like this:

$> crowdin-cli download
...
Warning: Downloaded translations do not match current project configuration. The following files will be omitted:
 - `Resources/zh-Hans.lproj/Localizable.strings'
 - `Resources/zh-Hans.lproj/Localizable.stringsdict'
 - `Resources/zh-Hans.lproj/InfoPlist.strings'
 - `Resources/zh-Hant.lproj/Localizable.strings'
 - `Resources/zh-Hant.lproj/Localizable.stringsdict'
 - `Resources/zh-Hant.lproj/InfoPlist.strings'
 - `Resources/pt-BR.lproj/Localizable.strings'
 - `Resources/pt-BR.lproj/Localizable.stringsdict'
 - `Resources/pt-BR.lproj/InfoPlist.strings'
 - `Resources/es-MX.lproj/Localizable.strings'
 - `Resources/es-MX.lproj/Localizable.stringsdict'
 - `Resources/es-MX.lproj/InfoPlist.strings'
... // other branches shows too like - `branch-name/Resources/pt-BR.lproj/InfoPlist.strings'

My local project file structure looks like this:

screen shot 2018-01-31 at 10 57 18 am

If I build and download from Crowdin website the structure looks like this:

screen shot 2018-01-31 at 10 59 16 am

Wondering if it's due to branches, in my example I do crowdin-cli download without branch param

Is there a way to exclude source directories?

We are translating a software that is divided into a core and several plugins. Some of the plugins are treated as 'core plugins' and some are not. The core plugins should be translated on Crowdin, so I added the corresponding regex to the yaml config (e.g. plugins/**/locale/messages.json).

Is there currently a way to specify certain URL patterns to be excluded or ignored from crowdin-cli, comparably to the .git/info/exclude file?

Invalid android langauges codes

This is my crowdin yml configuration:

project_identifier: ....
api_key: ...
base_path: ...

files:
  -
    source: '/app/src/main/res/values/strings.xml'
    translation: '/app/src/main/res/values-%android_code%/%original_file_name%'
    translate_attributes: '0'

This is my website configuration:
image

After running java -jar crowdin-cli.jar download
all the files are downloaded in the following format:
image

But when trying to compile the project I get the following error:

- app/src/main/res/values-kab-rKAB: Error: Invalid resource directory name

It seems like some of the language codes are incorrect and cause compilation errors.

When I use the 2 letters code it works, but it causes me to loose some of the translation languages.

Is this a known error and is there a solution?

Ignore unmatched files when download

Currently crowdin-cli shows file names that doesn't match configuration when download command is executed.

The simplest solution would be to add an optional argument to crowdin download.
E.g. --ignore-unmatch (false by default)

languages_mapping not properly working?

I use this mapping:

    languages_mapping:
      android_code:
        af: af
        ar: ar
        be: be
        ca: ca
        cs: cs
        da: da
        de: de
        el: el
        es: es
        et: et
        fi: fi
        fr: fr
        gl: gl
        iw: iw
        hi: hi
        hr: hr
        hu: hu
        in: in
        it: it
        iw: iw
        ja: ja
        ko: ko
        lt: lt
        nl: nl
        no: no
        pl: pl
        ro: ro
        ru: ru
        sk: sk
        sl: sl
        sr: sr
        sv: sv
        tr: tr
        uk: uk
        vi: vi

But receive this:

image

why is for example es not properly mapped although mapping is given?

What is `crowdin-cli download` (w/o branch argument) exactly supposed to do?

So, the description says Download latest translations from Crowdin. But what does that mean in practice?

In my opinion, it should download the files that are not part of any branch. So, for example. If I only have one file (let's call it mainFile) and then multiple branches of the same file. When I do crowdin-cli download I expect to get mainFile in the same way that if I do crowdin-cli download -b branch I get the file for that branch. But that's definitely not happening, I'm not even sure what things are been downloaded.

Could someone please clarify?

Thanks

Split project configuration and user credentials

Currently the crowdin.yaml file contains project-specific configuration and user credentials (api_key). This means that you can't commit this file in the code repository, because the API key would leak to other users. It would be great if crowdin-cli would allow 2 configuration files:

  • a user-specific, probably residing in $HOME/.crowdin.yaml
  • a project-specific, residing in the project directory

update json file using java

I am having a json like
{
"English" : ""
}

Here I want to get this file updated with another language content via some program.
Is there any java based solution for this?

Should warn if export is skipped when downloading translation files

Couldn't figure out why the newest translation files weren't downloading (the downloaded file didn't contain the latest changes). Ran the tool in verbose mode

crowdin-cli -v download -l ru >/tmp/debug.txt 2>&1

and noticed {"status":"skipped"}. The export api docs mention Please note that this method can be invoked only once for 30 minutes.

It would be nice if crowdin-cli would warn that export was skipped, so that it would be clear that I should try to download the latest changes later.

Relative base_path in crowdin.yaml doesn't work

Given this crowdin.yaml file:

project_identifier: poedit
base_url: http://api.crowdin.net
base_path: .

files:
  -
    source: /locales/poedit.pot
    translation: /locales/%two_letters_code%.po
    languages_mapping:
      two_letters_code:
        ckb: ckb
        en-GB: en_GB
        pt-BR: pt_BR
        val-ES: ca@valencia
        zh-CN: zh_CN
        zh-TW: zh_TW

Uploading the translations with crowdin-cli upload translations --auto-approve-imported --import-eq-suggestions (after uploading the POT file first) fails with

Warning: Skip `/locales/cs.po'

etc. After a while, I realized the problem is in the base_path. If I omit it (which has the same effect, because pwd is the default), it works. But then, I get the annoying Configuration file misses parameter base_path that defines your project root directory warning on every invocation.

Using an absolute path as base_path takes care of both, but that's not usable in practice: I cannot commit absolute path to the (public) repository, because different people may have it checked out in different locations (even I alone have different checkouts with different paths).

Not sure where this difference between . and absolute pwd comes from, perhaps the tool should absolutize any relative base_path first?

Error when using branches with slash

If I try to upload a branch like somehow/new-feature-branch with crowdin-cli upload sources -b somehow/new-feature-branch I get the error:

Creating a new branch `somehow/new-feature-branch'error: 17: Specified directory was not found

Ignore 0% translated languages when downloading

I can easily create mapping for translations.

We are a open source community project. In case people come and help for translation, we have some languages open in our crowdin page. Couple of them have 0% translation.

I want to ignore them when I am downloading from crowd-in. As far as I understand, it is impossible right now.

"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

Issue

$ 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.

Tags with version numbers

Thanks for the project!

I would really appreciate if you could add tags to mark release versions - that would ease searching and making diffs.

uploading translations - error: Unknown option --import-eq-suggestions

Invoking
java -jar crowdin-cli.jar upload --import-eq-suggestions translations
returns an error message
error: Unknown option --import-eq-suggestions

Below it says (excerpt):

SYNOPSIS
    <script> [global options] upload [--auto-update] sources
    <script> [global options] upload [--auto-approve-imported] [--import-duplicates] [--import-eq-suggestions] [-l crowdin_language_code|--language crowdin_language_code] translations

Seems to be valid usage for me... has this option been removed?

Using crowdin-cli 0.25 downloaded from crowdin.net, on Windows 8, with Java 7.

'crowdin-cli upload sources' with different keys and same translations

Hi,
i wanna know if there's a way to upload sources strings and tell crowdin to not apply translations if i already have those.
Sometimes i've to update my source file with different keys but i don't want crowdin automatically apply translations (this is the reason why i wanna create new keys instead of using what i already have).
Something like --import-duplicates or similar but for the source strings.

Ruby 1.9 requires to install specific versions of dependencies

We're using CircleCI for deployment/tests and we stumbled upon a problem this WE : we couldn't deploy because crowdin-cli wouldn't install.
We needed to add specific version of dependencies which upgraded, to not support 1.9 anymore
Use those lines (in CircleCI in a :before_deploy block) to restore a proper install, or restrict those in the GemFile :)
gem install mime-types -v 2.6.2
gem install rest-client -v 1.8
Cheers and keep it up !

Slowness on Ubuntu 14.04 - Ruby 2.3.0

Just installed RVM with Ruby 2.3.0 and the only gem installed is crowdin-cli.
After running crowdin-cli download sources for example, it takes around 10 minutes to complete the operation. Using strace, I can see the whole directory is being scanned even if the configuration YAML file tells which path to look for translations.

Very simple crowdin.yaml file:

files:
  -
    source: /resources/lang/default/*.php
    translation: /resources/lang/%two_letters_code%/%original_file_name%

Download with languages_mapping (locale to two_letters_code)

Hello,

I have a little issue to download files with languages_mapping from %locale% to %two_letters_code%.

I'm not sure this is an issue or voluntary on your part.

This i my config file:

files:
  -
    source: 'en/file.json'
    translation: '%two_letters_code%/%original_file_name%'
    languages_mapping:
      two_letters_code:
        # crowdin_language_code: custom_code
        'es-ES': 'es'

What happened when I start download:

Build ZIP archive with the latest translations - Skipped
Warning: Export was skipped. Please note that this method can be invoked only once per 30 minutes.
Download: `nl/file.json'
Download: `fr/file.json'
Warning: Downloaded translations do not match current project configuration. Some of the resulted files will be omitted.
 - `es-ES/file.json'

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.

Have crowdin-cli emit a warning when erasing keys

We have so many issues with (new) developers ulpoading from an outdated source file and erasing keys. It would be really nice if the cli could ask confirmation when erasing keys. It doesn't have to be the default behaviour, could be enabled with a flag in crowdin.yml.

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.