All Projects → metasmile → Strsync

metasmile / Strsync

Licence: gpl-3.0
A CLI tool for localization resource management on Xcode. Built with Google Translator.

Programming Languages

python
139335 projects - #7 most used programming language
language
365 projects

Projects that are alternatives of or similar to Strsync

I18n Extract
Manage localization with static analysis. 🔍
Stars: ✭ 152 (-3.18%)
Mutual labels:  translation, i18n
Deeply
PHP client for the DeepL.com translation API (unofficial)
Stars: ✭ 152 (-3.18%)
Mutual labels:  translation, i18n
I18n Ally
🌍 All in one i18n extension for VS Code
Stars: ✭ 1,931 (+1129.94%)
Mutual labels:  translation, i18n
Eslint Plugin I18n Json
Fully extendable eslint plugin for JSON i18n translation files.
Stars: ✭ 101 (-35.67%)
Mutual labels:  translation, i18n
Go I18n
Translate your Go program into multiple languages.
Stars: ✭ 1,834 (+1068.15%)
Mutual labels:  translation, i18n
Pseudo Localization
Dynamic pseudo-localization in the browser and nodejs
Stars: ✭ 109 (-30.57%)
Mutual labels:  translation, i18n
I18n Debug
Ever wondered which translations are being looked up by Rails, a gem, or simply your app? Wonder no more!
Stars: ✭ 143 (-8.92%)
Mutual labels:  translation, i18n
Elm I18n
Localization for Elm apps as a pre-build phase with import and export between elm code and CSV/PO
Stars: ✭ 68 (-56.69%)
Mutual labels:  translation, i18n
Dom I18n
Provides a very basic HTML multilingual support using JavaScript
Stars: ✭ 125 (-20.38%)
Mutual labels:  translation, i18n
React I18nify
Simple i18n translation and localization components and helpers for React.
Stars: ✭ 123 (-21.66%)
Mutual labels:  translation, i18n
Gitlab I18n Patch
Unofficial Japanese translation for GitLab Community Edition.
Stars: ✭ 98 (-37.58%)
Mutual labels:  translation, i18n
Punic
PHP translation and localization made easy!
Stars: ✭ 133 (-15.29%)
Mutual labels:  translation, i18n
Pootle
Online translation tool
Stars: ✭ 1,346 (+757.32%)
Mutual labels:  translation, i18n
Jquery I18next
i18next plugin for jquery usage
Stars: ✭ 143 (-8.92%)
Mutual labels:  translation, i18n
Transloco
🚀 😍 The internationalization (i18n) library for Angular
Stars: ✭ 1,185 (+654.78%)
Mutual labels:  translation, i18n
Traduora
Ever® Traduora - Open-Source Translation Management Platform
Stars: ✭ 1,580 (+906.37%)
Mutual labels:  translation, i18n
React Intl Hooks
React hooks for internationalization without the hassle ⚛️🌍
Stars: ✭ 64 (-59.24%)
Mutual labels:  translation, i18n
Gettext Go
🆎 GNU gettext for Go (Imported By Kubernetes)
Stars: ✭ 66 (-57.96%)
Mutual labels:  translation, i18n
Phabricator zh hans
Phabricator zh-Hans Translation & Tools.
Stars: ✭ 113 (-28.03%)
Mutual labels:  translation, i18n
Talkr
Talkr is a super small i18n provider for React applications. It supports Typescript, has 0 dependencies, and is very easy to use.
Stars: ✭ 129 (-17.83%)
Mutual labels:  translation, i18n

Awesome PyPI version License: GPL v3

    

Supported by Jetbrains Open Source License Program


Automatically translate and synchronize '.strings' files from the defined base language

The basic concept of this python CLI tool is straightforward file name based one-way synchronizer. If you are running, other localized resources will have the same key with automatically translated strings. Of course, string on the key that already exists will not be modified at all.

Requirements

Install

pip install strsync

Enable Google Cloud Translation Python API

Set your account and authentication credentials up with Google's guide for local envirnment.

https://cloud.google.com/translate/docs/reference/libraries#client-libraries-install-python

If you can't use Translation feature, use '-w' option to copy all items from Base language.

$ strsync ./myapp/Resources/Localizations -w

Update Python SSL packages if needed

this is not required for python-2.7.9+

pip install requests[security]

Usage

Naturally, this tool follow standard ISO639 1~2 codes or apple's official document or this tsv table

usage: strsync-runner.py [-h] [-b BASE_LANG_NAME]
                         [-x EXCLUDING_LANG_NAMES [EXCLUDING_LANG_NAMES ...]]
                         [-f [FORCE_TRANSLATE_KEYS [FORCE_TRANSLATE_KEYS ...]]]
                         [-o FOLLOWING_BASE_KEYS [FOLLOWING_BASE_KEYS ...]]
                         [-w [FOLLOWING_BASE_IF_NOT_EXISTS [FOLLOWING_BASE_IF_NOT_EXISTS ...]]]
                         [-l CUTTING_LENGTH_RATIO_WITH_BASE [CUTTING_LENGTH_RATIO_WITH_BASE ...]]
                         [-c [IGNORE_COMMENTS [IGNORE_COMMENTS ...]]]
                         [-v [VERIFY_RESULTS [VERIFY_RESULTS ...]]]
                         [-s [INCLUDE_SECONDARY_LANGUAGES [INCLUDE_SECONDARY_LANGUAGES ...]]]
                         [-i [IGNORE_UNVERIFIED_RESULTS [IGNORE_UNVERIFIED_RESULTS ...]]]
                         [target path] [only for keys [only for keys ...]]

Automatically translate and synchronize .strings files from defined base
language.

positional arguments:
  target path           Target localization resource path. (root path of
                        Base.lproj, default=./)
  only for keys         Some specified keys for exclusive work. All operations
                        will work for only that keys therefore other keys will
                        be ignored. Not specified by default. (default=None)

optional arguments:
  -h, --help            show this help message and exit
  -b BASE_LANG_NAME, --base-lang-name BASE_LANG_NAME
                        A base(or source) localizable resource
                        name.(default='Base'), (e.g. "Base" via 'Base.lproj',
                        "en" via 'en.lproj')
  -x EXCLUDING_LANG_NAMES [EXCLUDING_LANG_NAMES ...], --excluding-lang-names EXCLUDING_LANG_NAMES [EXCLUDING_LANG_NAMES ...]
                        A localizable resource name that you want to exclude.
                        (e.g. "Base" via 'Base.lproj', "en" via 'en.lproj')
  -f [FORCE_TRANSLATE_KEYS [FORCE_TRANSLATE_KEYS ...]], --force-translate-keys [FORCE_TRANSLATE_KEYS [FORCE_TRANSLATE_KEYS ...]]
                        Keys in the strings to update and translate by force.
                        (input nothing for all keys.)
  -o FOLLOWING_BASE_KEYS [FOLLOWING_BASE_KEYS ...], --following-base-keys FOLLOWING_BASE_KEYS [FOLLOWING_BASE_KEYS ...]
                        Keys in the strings to follow from "Base.
  -w [FOLLOWING_BASE_IF_NOT_EXISTS [FOLLOWING_BASE_IF_NOT_EXISTS ...]], --following-base-if-not-exists [FOLLOWING_BASE_IF_NOT_EXISTS [FOLLOWING_BASE_IF_NOT_EXISTS ...]]
                        With this option, all keys will be followed up with
                        base values if they does not exist.
  -l CUTTING_LENGTH_RATIO_WITH_BASE [CUTTING_LENGTH_RATIO_WITH_BASE ...], --cutting-length-ratio-with-base CUTTING_LENGTH_RATIO_WITH_BASE [CUTTING_LENGTH_RATIO_WITH_BASE ...]
                        Keys in the float as the ratio to compare the length
                        of "Base"
  -c [IGNORE_COMMENTS [IGNORE_COMMENTS ...]], --ignore-comments [IGNORE_COMMENTS [IGNORE_COMMENTS ...]]
                        Allows ignoring comment synchronization.
  -v [VERIFY_RESULTS [VERIFY_RESULTS ...]], --verify-results [VERIFY_RESULTS [VERIFY_RESULTS ...]]
                        Verify translated results via reversed results
  -s [INCLUDE_SECONDARY_LANGUAGES [INCLUDE_SECONDARY_LANGUAGES ...]], --include-secondary-languages [INCLUDE_SECONDARY_LANGUAGES [INCLUDE_SECONDARY_LANGUAGES ...]]
                        Include Additional Secondary Languages. (+63 language
                        codes)
  -i [IGNORE_UNVERIFIED_RESULTS [IGNORE_UNVERIFIED_RESULTS ...]], --ignore-unverified-results [IGNORE_UNVERIFIED_RESULTS [IGNORE_UNVERIFIED_RESULTS ...]]
                        Allows ignoring unverified results when appending
                        them.

Examples to use

~/Documents/myapp/myapp/Resources/Localizations$ strsync
~/Documents/myapp/myapp/Resources/Intents$ strsync

Define specific path you want. A parent path of *.lproj(s).

$ strsync ./myapp/Resources/Localizations
$ strsync ./myapp/Resources/Intents

Copy all items from Base language without translation.

$ strsync ./myapp/Resources/Localizations -w

All operations will work for only keys "exclusive key1" "exclusive key2" "exclusive key3". Other keys will be ignored.

$ strsync ./myapp/Resources/Localizations "exclusive key1" "exclusive key2" "exclusive key3"

Excluding japanese, spanish, finnish

$ strsync ./myapp/Resources/Localizations -x ja es fi

Forcefully translate and update by specific keys you want.

$ strsync -f Common.OK Common.Undo "Key name which contains white space"

Forcefully translate and update by All keys.

$ strsync -f  (input nothing)

When you want to accept the values in the 'Base'.

$ strsync -o autoenhance flashmode

#before
"flashmode" = "وضع الفلاش";
"flashmode.auto" = "السيارات";
"flashmode.on" = "على";
"autoenhance" = "تعزيز السيارات";

#after
"flashmode" = "Flash Mode";
"flashmode.auto" = "السيارات";
"flashmode.on" = "على";
"autoenhance" = "Auto-Enhance";

If you add an option -v or --verify-results, String similarity of the reversed translation result for each language will be displayed.

$ strsync (...) -v

el
  Hi: Hi -> Γεια σου -> Hi, Matched: 100%
fr-CA
  Hi: Hi -> Salut -> Hello, Matched: 50%
id
  Hi: Hi -> Hai -> Two, Matched: 0%
fr
  Hi: Hi -> Salut -> Hello, Matched: 50%
uk
  Hi: Hi -> Привіт -> Hi, Matched: 100%
hr
  Hi: Hi -> Bok -> Book, Matched: 0%
da
  Hi: Hi -> Hej -> Hi, Matched: 100%
ja
  Hi: Hi -> こんにちは -> Hello, Matched: 50%
he
  Hi: Hi -> היי -> Hey, Matched: 50%
ko
  Hi: Hi -> 안녕 -> Hi, Matched: 100%
sv
  Hi: Hi -> Hej -> Hi, Matched: 100%
es-MX
  Hi: Hi -> Hola -> Hello, Matched: 50%
sk
  Hi: Hi -> ahoj -> Hi, Matched: 100%
zh-CN
  Hi: Hi -> 你好 -> How are you doing, Matched: 50%

or if you add --ignore-unverified-results [Integer, Percentage (0~100) (default=0)], If the similarity of each reversed translation result is under the given value, that string will be skipped(ignored).

ex)

strings will be skipped if its text similarity from reversed translation result is under 50

$ strsync (...) --ignore-unverified-results 50

el
  Hi: Hi -> Γεια σου -> Hi, Matched: 100%
fr-CA
  (Ignored) Hi: Hi -> Salut -> Hello, Matched: 50%
id
  (Ignored) Hi: Hi -> Hai -> Two, Matched: 0%
fr
  (Ignored) Hi: Hi -> Salut -> Hello, Matched: 50%
uk
  Hi: Hi -> Привіт -> Hi, Matched: 100%
hr
  (Ignored) Hi: Hi -> Bok -> Book, Matched: 0%
da
  Hi: Hi -> Hej -> Hi, Matched: 100%
ja
  (Ignored) Hi: Hi -> こんにちは -> Hello, Matched: 50%
he
  (Ignored) Hi: Hi -> היי -> Hey, Matched: 50%
ko
  Hi: Hi -> 안녕 -> Hi, Matched: 100%
sv
  Hi: Hi -> Hej -> Hi, Matched: 100%
es-MX
  (Ignored) Hi: Hi -> Hola -> Hello, Matched: 50%
sk
  Hi: Hi -> ahoj -> Hi, Matched: 100%
zh-CN
  (Ignored) Hi: Hi -> 你好 -> How are you doing, Matched: 50%

Utilities

There are some additional scripts to help your workflow with strsync.

https://github.com/metasmile/strsync/tree/master/utils

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].