Giter Club home page Giter Club logo

translateeverywhere's Introduction

TranslateEverywhere

This tool aims to facilitate the sharing of files between different language platforms.

Motivation

In the context of mobile applications you may have to transform iOS language file to Android language. Of course, you can make series of copy and paste but it quickly becomes tedious. And more if your app support many languages

Yes convertors like https://localise.biz/free/converter/ios-to-android already exist and you may have :

iOS file :

"APP_NAME"="Trololo";
"A_FUCKING_KEY"="Settings";

become :

<string name="APP_NAME">Trololo</string>
<string name="A_FUCKING_KEY">Settings</string>

Two problems :

  • On Android by convention string names are low cased
  • You are not agree with the name

Then, you may want to organize your code in file and by group like it :

<!-- strings.xml -->
<string name="title_email">Email</string>
<string name="title_password">Password</string>

<string name="hint_email">Type your email</string>
<string name="hint_password">Please, don't type 123456...</string>
<!-- strings_activity_settings.xml -->
<string name="settings">Settings</string>

Quick start

First, you have to create a file which make the link between android string names and ios string names (or any other supported format) like it :

## [output_file_name]
[strings name]=[his correspondence]
[another string name]=[other correspondence or the same]

[string name]=?
## [new_output_file_name]
[strings name]=[his correspondence]

If we take our above example :

## strings.xml
title_email=IOS_TITLE_EMAIL
title_password=IOS_TITLE_PASSWD

hint_email=IOS_HINT_EMAIL
hint_passwd=?
## strings_activity_settings.xml
settings=A_FUCKING_KEY

Each ## will create a new file and next strings will be write in. Each blank line will create a blank line in the output file. You can specify that a strings don't have correspondence with ?, they will be useful in the future

Well, we have make the most boring. Now we just have to type one command (trew is the program name) :

$ trew [convert_type] [link_file] [input_files, ...] [output directory]

Arguments :

  • convert_type : currently i2a (iOS to Android) or a2i (Android to iOS)
  • link_file : file which make the correspondence between them
  • input_files : your source files with string names and their values
  • output_directory : directory where generated file will be written

An example ?

$ trew i2a my_link_file.tew Localizable_fr.strings values-fr
$ ls values-fr
strings.xml strings_activity_settings.xml
$ cat values-fr/strings_activity_settings.xml
<resource>
	<strings name="settings">Paramètres</string>
<resource>

That's all !

Trick : trew can generate for you skeleton of link file :

$ trew skeleton [type_file] [input_files, ...]

Arguments :

  • type_file : currently android or ios
  • input_files : your source file with string name to analyse and reproduce

Download

beta : https://mega.co.nz/#!Ux4WBIQS!erOUW0aVu4QHrb2Yomfn7bGJP3zeXbC8T2ClrR52YYw

Credit

Author : Nicolas Barranger ([email protected])

Follow me on Google+ Follow me on Twitter

translateeverywhere's People

Contributors

wicowyn avatar

Watchers

James Cloos 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.