Git Product home page Git Product logo

honyaku's Introduction

Honyaku

Crates.io

Honyaku (hon'yaku) suru in japanese means translation or to translate. And we believe it applies to this software, a web application helper to generate Android and iOS translation files (.xml & .strings) using a CSV file as a source.

Right now, we don't support .po files, because we develop this tool to help us in our day to day work (we don't work with .po files), and we thought that maybe as it is, this software could help others in the same quest we fought (making easy translation process), but if lot of people asks for .po support we could add it (or maybe you could added it and make a PR? ;] )

honyaku-2

Installation

This application is a node express-server based application. You will need to install npm.

  1. Download node for your operative system:

    https://nodejs.org/en/download/package-manager/
    
  2. Next, download this project and go to root path, there you'll see a file called express-server.js and package.json (with other files), use the next command to install npm packages:

    sudo npm install
    
  3. Next step is to run express-server using the next command:

     node express-server.js
    

3.1. If you want to edit any JS file, think of using nodemon. Is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development

    sudo npm install -g nodemon
  1. Open a web browser and type this url:

     http://localhost:3000/
    

Now, if everything goes OK you will be able to see something like the image above

local-1

  1. You need now to select if you will have or will not have plurals:

local-2

  1. If you select NO for plurals and click on process button, you will see a Success! message. Go to Honyaku/download path and select iOS or Android, you'll see the localized files for each language specified in the CSV file converted in .xml for Android and .strings for iOS.

local-3

The Success Message looks like this:

Success

  1. If you select YES for plurals, you must select the base CSV file and the CSV plurals file and click Process button, if everything goes well you will see a success! message. Go to download path and select iOS or Android, you'll see the localized files for each language specified in CSV file there.

Plurals

Success Message looks like this:

Success

This is the path were the iOS files are downloaded

iOS file

This is the path were the Android files are downloaded

Android

CSV File

The CSV file needs to have the next structure: key (lower case) and the short name for each language supported in capital letters, placed in each column of the CSV. The first column should always be the key word, next column should be each of the supported languages in your application.

  • ๐Ÿ“„ You can use the Example folder to see how the CSV are constructed.

  • ๐Ÿ“ Also, you can create in path download/Android and download/iOS all the languages that your app will support.

key EN ES
app_string This is a test Esto es una prueba
app_string_more This is other text Este es otro texto

The key word represents the key that your app will use to localize text for each language.

  • Adding variables

As you will probably know, sometimes is necessary to add variables between our text. Honyaku supports this feature, adding a wildcard (double asterisk) inside the localizable text. For example:

Before After
The user is 20 years old The user is **ld** years old
My dog is called: Gandalf My dog is called: **s**
http://es.someURL.com/12 , http://en.someURL.com/13 http://**1s**.someURL.com/**2ld**
  • Data type supported
Type Wildcard
String s
Double d
Long Double ld
Float f
  • Example output
CSV file text Android output iOS output
This application was made with love by **1s**.\n\nTo say thanks or buy them a coffe say something ;). This application was made with love by %1$s.\n\nTo say thanks or buy them a coffe say something ;). "app_thanks" = "This application was made with love byr %1$@.\n\nTo say thanks or buy them a coffe say something ;).";
  • Escape symbols

For now, we are escaping the % symbol. This case is evaluated in the application, but if you need to escape more symbols, please add an issue and we will try to add it.

Symbol Escaping
20% **ld**%

Plurals

You can create a CSV file to process plurals. This is how the structure looks like:

PLS KEY EN ES
app_people one **ld** traveller **ld** viajero
app_people other **ld** travellers **ld** viajeros
app_night one **ld** night **ld** noche
app_night other **ld** nights **ld** noches

You can see all of the rule cases supported for each language in: http://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html

Example:

Language Plural Type
ES one y other
EN one y other
IT one y other
PT one y other
FR one y other
CA one , two, few, other
Dutch (NL) one y other
German (DE) one y other
ALL zero

Note:

if you have any errors deploying express-server.js try to kill the process in CLI:

Search for express-server process:

    $:  ps -ef | grep express

Kill the process:

    $:  kill process-number

TO DO

  • Errors control
  • Tests

Author Information

This role was created in 2017 by Sofa E Swidarowicz Andrade, iOS engineer at Rentalia

honyaku's People

Contributors

phynet avatar

Stargazers

 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.