Bisu manages your app iOS, Android and RoR localization files for you. No more copy+paste induced errors!
It works with the following sources out of the box:
gem install bisu
- Open terminal in app project base
- Run:
bisu
- That's it!*
*given that someone already configured Bisu
- 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:
type: url
url: <A-GET-URL>
dictionary:
type: tolgee
api_key: <TOLGEE-API-KEY>
host: <TOLGEE-CUSTOM-HOST> (default: app.tolgee.io)
- First "Publish to the web" your Google Sheet
- Share only the sheet that contains the translations
- Make sure you CSV format
- First column should contain the translation keys
- First row should contain the locale for each language
dictionary:
type: google_sheet
url: <GOOGLE-DRIVE-SHEET-CSV-URL>
keys_column: <GOOGLE-DRIVE-KEY-COLUMN-TITLE>
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 a *.translatable version for your platform specific localization files:
example: Localizable.strings.translatable
"delete" = "$general.delete$";
"cancel" = "$general.cancel$";
"close" = "$general.close$";
"requestName" = "$request.name{user_name: %@}$";
example: strings.xml.translatable
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="delete">$general.delete$</string>
<string name="cancel">$general.cancel$</string>
<string name="close">$general.close$</string>
<string name="request_name">$request.name{user_name: %s}$</string>
</resources>
example: config/locales/yml.translatable
$specialKLocale$:
resources:
delete: $general.delete$
cancel: $general.cancel$
close: $general.close$
messages:
request_name: $request.name$
Given a key with params such as "Missing ${attribute} value"
$some-key-with-params{param: %s}$
:Missing $s value
$some-key-with-params//ignore-params$
:Missing ${attribute} value
When it should be localized as given such as "Perfect: 100 (%)"
$some-key-with-percentage$
:Perfect: 100%
When it should be localized as a formated string such as "Perfect: %{percentage} (%)"
$some-key-with-percentage{percentage: %d}//formatted-string$
:Perfect: %d (%%)
(note the double%
)
$specialKLocale$
: the respective locale of this file$specialKLanguage$
: the respective language on the translation platform
$specialKComment1$
:This file was automatically generated based on a translation template.
$specialKComment2$
:Remember to CHANGE THE TEMPLATE and not this file!