Description

A ripl plugin that translates ripl to your preferred language. Current supported languages: spanish, chinese, german, portuguese.

Usage

Add to your ~/.riplrc:

require 'ripl/i18n'

If a locale exists for your language and is set via your shell variable $LANG, this plugin automatically uses it. Otherwise, explicitly set your language with:

# :es maps to es.yml
Ripl.config[:i18n_locale] = :es

If you want to load and use your own locale:

Ripl::I18n.load 'path/to/my_lang.yml'
Ripl.config[:i18n_locale] = :my_lang

Once you’ve configured a locale, all messages, errors and even help will print in that locale’s language. For example, ripl’s help in german:

$ LANG=de ripl -h
Benutzung: ripl [BEFEHL] [ARGUMENTE] [OPTIONEN]

Optionen:
  -f                  Unterdrücke Laden von ~/.irbrc
  -F                  Unterdrücke Laden von ~/.riplrc
  -d, --debug         Setze $DEBUG auf wahr (wie `ruby -d')
  -I PATH             Pfad an den Anfang des $LOAD_PATH hinzufügen. Begrenze mehrfache Pfade mit ':'
  -r, --require FILE  Lade Datei mittels "require" (wie `ruby -r')
  -v, --version       Gib Version aus
  -h, --help          Gib Hilfe aus

Contribute Your Language

As I would like to make ripl available in as many languages as possible, please add your own! Here’s all you have to do:

  • Fork this project.

  • Create a .yml file under lib/ripl/i18n/locales/ for your language. If you’re not sure what locale to use for your language, see some examples.

  • Be sure to translate all the keys in lib/ripl/i18n/locales/en.yml.

Credits

  • janlelis for auto locale + german translation

  • godfat for chinese translation

Inspiration

yugui.jp/articles/863