0.0
No commit activity in last 3 years
No release in over 3 years
Easy localization for RubyMotion.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

MotionLocalize

This gem allows you to translate your Android and iOS apps easily.

Warning

This gem is currently in very early-stage. Use it at your own risk :)

Build Status Gem Version

Installation

gem 'MotionLocalize'

Then:

$ bundle

Usage

Add a config/locales dir and put your locale.yml files in it.

You can generate the platform specific files with rake localize. This task is automaticaly executed when you build your application.

# en.yml
hello: Hello
how_are_you: How are you ?
show_my_age: I'm %{age} old

# fr.yml
hello: Bonjour
how_are_you: Comment allez-vous ?
show_my_age: J'ai %{age} ans

On Android, the files resources/values-en/strings.xml and resources/values-fr/strings.xml will be created.
On iOS, the files resources/en.lproj/Localizable.strings and resources/fr.lproj/Localizable.strings will be created.

On your code, you can get the translation with

# use a symbol
puts :hello._

# use a string
puts 'hello'._

# use substitution
puts :show_my_age._ age: 36

# You can also use
puts 'show_my_age'.translate(age: 36)

A note on Android

As you can read here, Android love Context stuff. In order to get your strings translated on Android, you have to initialize MotionLocalize.context (from you Android::App::Application or first activity).

Todo

  • Tests

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Make some specs pass
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

License

Released under the MIT license.