See Rhodes System API Samples application as an example.

Rhodes use localization_simplified library to support non-English languages.

Add to build.yml:

extensions: ["rholang"]

In case of several extensions, insert space after extension name and comma:

extensions: ["rholang", "net-http"]

Create utf-8 encoded file in app <app_folder>/app/lang/lang_<lang_id>_<country_id>.rb or <app_folder>/app/lang/lang_<lang_id>.rb. This file will be automatically loaded by rhodes based on current locale.

For Example create lang_en.rb:

module Localization
    Views = {
        :greeting => "This is test"

And use this string in the view:

<ul id="home">
    <li><%= Localization::Views[:greeting] %></li>

To switch locale at runtime use:

System::set_locale('es') #set current locale to Spanish


All non-ascii symbols should be utf-8 encoded.

To get current locale on the phone use System.get_locale method. It returns ‘en’, ‘de’, etc. locale id’s.

To show localized Date and Time:

Time.now.strftime("%B %d, %Y %H:%M") # all names will be localized
Date.today.strftime("%B %e, %Y") # all names will be localized

To show currency (see rails analog for details):

Back to Top