Code Monkey home page Code Monkey logo

crowdin-cli-py's People

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

crowdin-cli-py's Issues

Warning: Downloaded translations do not match current project configuration for en-US and en languaege in one project

i have following localization project file structure

source files

lang/ru.lproj/common/datapack.po
lang/ru.lproj/common/dialogs.po

with two language translations en

lang/en.lproj/common/datapack.po
lang/en.lproj/common/dialogs.po

and en-US

lang/en_US.lproj/common/datapack.po
lang/en_US.lproj/common/dialogs.po

and have two configs for separate language (en and en_US) workflow

crowdin_config_ISO-639.yml

api_key: XXX
base_path: XXX
files:
- {source: /lang/ru.lproj/common/datapack.po, translation: /lang/%two_letters_code%.lproj/common/%original_file_name%}
- {source: /lang/ru.lproj/common/dialogs.po, translation: /lang/%two_letters_code%.lproj/common/%original_file_name%}
project_identifier: XXX

and crowdin_config_RFC-3066.yml

api_key: XXX
base_path: XXX
files:
- {source: /lang/ru.lproj/common/datapack.po, translation: /lang/%locale_with_underscore%.lproj/common/%original_file_name%}
- {source: /lang/ru.lproj/common/dialogs.po, translation: /lang/%locale_with_underscore%.lproj/common/%original_file_name%}
project_identifier: XXX

when i run UPLOAD workflow

crowdin-cli-py -c crowdin_config_ISO-639.yml upload sources
crowdin-cli-py -c crowdin_config_ISO-639.yml upload translations -l en
crowdin-cli-py -c crowdin_config_RFC-3066.yml upload translations -l en-US

upload working FINE

but when i run Download workflow

crowdin-cli-py -c crowdin_config_ISO-639.yml download -l en
crowdin-cli-py -c crowdin_config_RFC-3066.yml download -l en-US

for en_US language i have strange warning

Warning: Downloaded translations do not match current project configuration. Some of the resulted files will be omitted.

and en-US.zip unpacked to wrong language:

lang/en.lproj/common/datapack.po
lang/en.lproj/common/dialogs.po

how i can change file structure to try fix it?

languages_mapping

only partial matches with %locale%
I have the following lines in config file:

  source: '/en.lproj/*.strings'
  translation: '/%locale%.lproj/%original_file_name%'
  languages_mapping:
    locale:
      # crowdin_locale: local_name
      'ru-RU': 'ru'
      'zu-ZA': 'zu'
      'zh-CN': 'zh-Hans'
      'es-ES': 'es'

when doing upload / download, I end up with following folders:

es.lproj
zh-Hans.lproj
ru-RU.lproj - this isn't matched for some reason
zu-ZA.lproj - this isn't matched for some reason

Uncorrect path find for translations

$ crowdin-cli-py --version
crowdin-cli-py 0.95.1
$ cat crowdin.yaml 
project_identifier: poradnia
api_key_env: CROWDIN_API_KEY

files:
  -
    source: '/poradnia/**/locale/en/LC_MESSAGES/django.po'
    translation: '/poradnia/**/locale/%two_letters_code%/LC_MESSAGES/django.po'

For source files everything is great:

$ crowdin-cli-py list translations
Warning: Configuration file misses parameter `base_path` that defines your project root directory. Using current directory as a root directory.
poradnia/keys/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/templates/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/events/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/letters/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/records/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/cases/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/advicer/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/tasty_feedback/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/users/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po

For translations files subsitutions fail:

$ crowdin-cli-py list translations
Warning: Configuration file misses parameter `base_path` that defines your project root directory. Using current directory as a root directory.
poradnia/keys/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/templates/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/events/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/letters/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/records/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/cases/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/advicer/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/tasty_feedback/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
poradnia/users/locale/en/LC_MESSAGES/locale/pl/LC_MESSAGES/django.po
$ find poradnia -name 'django.po' -wholename '*/pl/*'
poradnia/keys/locale/pl/LC_MESSAGES/django.po
poradnia/templates/locale/pl/LC_MESSAGES/django.po
poradnia/events/locale/pl/LC_MESSAGES/django.po
poradnia/letters/locale/pl/LC_MESSAGES/django.po
poradnia/records/locale/pl/LC_MESSAGES/django.po
poradnia/cases/locale/pl/LC_MESSAGES/django.po
poradnia/advicer/locale/pl/LC_MESSAGES/django.po
poradnia/tasty_feedback/locale/pl/LC_MESSAGES/django.po
poradnia/users/locale/pl/LC_MESSAGES/django.po```

What I am doing wrong?

Download translations does not respect languages_mapping

I have a crowdin.yaml with the following mapping:

files:
  -                                                                                                                                                                                          
    source: '/src/main/res/values/strings.xml'
    translation: '/src/main/res/values-%android_code%/%original_file_name%'
    languages_mapping:
      android_code:
        # we need this mapping since Crowdin expects directories                                                                                                                             
        # to be named like "values-uk-rUA"                                                                                                                                                   
        # acording to specification instead of just "uk"                                                                                                                                     
        af: af
        ar: ar
        bg: bg
        ca: ca
        cs: cs
        da: da
        de: de
        el: el
        es-ES: es
        et: et
        fa: fa
        fr: fr
        he: he
        hu: hu
        id: id
        it: it
        iw: iw
        ja: ja
        ko: ko
        nb: nb
        nl: nl
        pl: pl
        ro: ro
        ru: ru
        sk: sk
        sl: sl
        sr: sr
        sv-SE: sv
        tr: tr
        vi: vi
        uk: uk
        en: en
        no: no

Upload works, it correctly uploads the strings.xml files for all existing languages.

On download however, it does not map the codes and subsequently creates about 20 new directories with incorrect codes:

Example of existing directories:

  • values-sk
  • values-sl
  • values-sv

Example of newly created directories:

  • values -sk-rSK
  • values-sk-rSI
  • values-sk-rSP
  • values-sv-rSE

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.