Giter VIP home page Giter VIP logo

strsync's Introduction

[AD] Meet our app using stringsync, Elie - Your next mobile photography assistant. http://elie.camera

Awesome PyPI version License

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

The basic concept of this tool is simple file name based one-way synchronizer. While the actual translation work, My biggest desire was to just fill an empty strings quickly. In a normal project, automatic translation is sufficient. Because They are always simple sentences. Yes, No, Do it, Not agree, etc..

If you are running, other localized resources will have exactly 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

Getting your client id/secret id to use Microsoft Translation API

Try accordance with this explanation

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 csv file

usage: strsync    [-h] [-b BASE_LANG_NAME]
                   [-x [EXCLUDING_LANG_NAMES ...]] -c
                   CLIENT_ID -s CLIENT_SECRET
                   [-f [FORCE_TRANSLATE_KEYS ...]]
                   [target path]

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

positional arguments:
  target path           Target localizable resource path. (root path of
                        Base.lproj, default=./)

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 ...]
                        A localizable resource name that you want to exclude.
                        (e.g. "Base" via 'Base.lproj', "en" via 'en.lproj')
  -c CLIENT_ID, --client-id CLIENT_ID
                        Client ID for MS Translation API
  -s CLIENT_SECRET, --client-secret CLIENT_SECRET
                        Client Secret key for MS Translation API
  -f [FORCE_TRANSLATE_KEYS ...], --force-translate-keys [FORCE_TRANSLATE_KEYS ...]
                        Keys in the strings to update and translate by force.
  -fb [FOLLOWING_BASE_KEYS ...], --following-base-keys [FOLLOWING_BASE_KEYS ...]
                        Keys in the strings to follow from "Base".
  -fbl [FOLLOWING_BASE_KEYS_IF_LENGTH_LONGER ...], --following-base-keys-if-length-longer
                        Keys in the strings to follow from "Base" 
                        if its length longer than length of "Base" value.

Examples to use

$ strsync -c clien_idXXXX -s clien_secretXXXX

Define specific path you want.

$ strsync ./myXcodeProj/Resources/Localizations -c clien_idXXXX -s clien_secretXXXX

Excluding japanese, spanish, finnish

$ strsync ./myXcodeProj/Resources/Localizations -c clien_idXXXX -s clien_secretXXXX -x ja es fi

Forcefully translate and update by specific keys you want.

$ strsync -c clien_idXXXX -s clien_secretXXXX -f Common.OK Common.Undo "Key name which contains white space"

Forcefully translate and update by All keys.

$ strsync -c clien_idXXXX -s clien_secretXXXX -f  (input nothing)

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

$ strsync -c clien_idXXXX -s clien_secretXXXX -fb autoenhance flashmode

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

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

strsync's People

Contributors

metasmile avatar

Watchers

 avatar

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.