paulgregor / crowdin-cli-py Goto Github PK
View Code? Open in Web Editor NEWA command-line client for the Crowdin API
License: MIT License
A command-line client for the Crowdin API
License: MIT License
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?
Hi guys,
Do you have any plans to support latest features from official crowdin-cli (e.g. versions management, uploading files to specified path with specified type, etc.)?
Thank you!
Might send a pull request for this at some point..
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
$ 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?
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:
Example of newly created directories:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.