Bisu 홀

Status Gem

Bisu manages your app iOS, Android and RoR localization files for you. No more copy+paste induced errors!

Instalation

gem install bisu

Usage

  1. Open terminal in app project base
  2. Run: bisu
  3. That's it!*

*given that someone already configured Bisu

Setup your configuration file

  1. Create in your project base folder a translatable.yml:
  type: <iOS|Android|RoR>

  dictionary:
    (see options below)

  translate:
    - in: path/to/1st/file.translatable
      out: path/to/%{locale}/strings.xml
      out_en: path/to/default/strings.xml
    - in: path/to/2nd/file.translatable
      out: path/to/2nd-%{locale}/strings.xml

  languages:
    - locale: en
      language: en # the language as it appears in the dictionary
    - locale: en-US
      language: en-us
      fallback_language: en
    - locale: pt
      language: pt
Dictionary from a URL source:
  dictionary:
    type: url
    url: <A-GET-URL>
Google Sheets Dictionary:
  1. First "Publish to the web" your Google Sheet
  2. Share only the sheet that contains the translations
  3. First column should contain the translation keys
  4. First row should contain the locale for each language
  dictionary:
    type: google_sheet
    sheet_id: <GOOGLE-DRIVE-SHEET-ID>
    keys_column: <GOOGLE-DRIVE-KEY-COLUMN-TITLE>
OneSky integration:
  dictionary:
    type: one_sky
    api_key: <ONE-SKY-API-KEY>
    api_secret: <ONE-SKY-API-SECRET>
    project_id: <ONE-SKY-PROJECT-ID>
    file_name: <ONE-SKY-FILE-NAME>

Create translation templates

Create a *.translatable version for your platform specific localization files:

iOS

example: Localizable.strings.translatable

  // $specialKComment1$
  // $specialKComment2$

  // Locale: $specialKLocale$; Language used: $specialKLanguage$

  /***********
  *  General
  ************/

  "klGeneral_Delete" = "$kDelete$";
  "klGeneral_Cancel" = "$kCancel$";
  "klGeneral_Close"  = "$kClose$";
  "klRequestName"    = "$kRequestName{user_name: %@}$";
Android

example: strings.xml.translatable

  <?xml version="1.0" encoding="utf-8"?>

  <!-- $specialKComment1$ -->
  <!-- $specialKComment2$ -->
  <!-- Locale: $specialKLocale$; Language used: $specialKLanguage$ -->

  <resources>
      <string name="delete">$kDelete$</string>
      <string name="cancel">$kCancel$</string>
      <string name="close">$kClose$</string>
      <string name="request_name">$kRequestName{user_name: %s}$</string>
  </resources>
Ruby on Rails

example: config/locales/yml.translatable

  $specialKLocale$:
    resources:
      delete: $kDelete$
      cancel: $kCancel$
      close: $kClose$
    messages:
      request_name: $kRequestName$