0.01
No release in over 3 years
A i18n tool to translate your desktop application in several languages. It is just a wrapper for R18n core library. It has nice Ruby-style syntax, filters, flexible locales, custom loaders, translation support for any classes, time and number localization, several user language support, agnostic core package with out-of-box support for Rails, Sinatra and desktop applications.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.5.0
~> 0.7.1
~> 3.10
~> 1.6
~> 0.5.1
~> 0.21.0
~> 0.11.0

Runtime

~> 5.0
 Project Readme

R18n Desktop

Cirrus CI - Base Branch Build Status Codecov branch Code Climate Depfu License Gem

A tool to translate your desktop application to several languages.

It is just a wrapper for R18n core library. See R18n documentation for more information.

Features

  • Nice Ruby-style syntax.
  • Filters.
  • Model Translation (or any Ruby object).
  • Auto-detect user locales.
  • Flexible locales.
  • Total flexibility.

See full features in main README.

How To

  1. Create translations dir. For example: ./i18n/.

  2. Add file with translation to ./i18n/ with language code in file name (for example, en.yml for English or en-us.yml USA English dialect). For example, ./i18n/en.yml:

    file:
     add: Add file
     delete: Delete file %1
    
    files: !!pl
     0: No files
     1: One file
     n: '%1 files'
  3. Add R18n to your application:

    require 'r18n-desktop'
  4. Load I18n object:

    R18n.from_env('i18n/')

User can set the locale manually:

 ```ruby
R18n.from_env('i18n/', manual_locale)
 ```
  1. Include mixin to use helpers:

    include R18n::Helpers
  2. Use translation messages to user. For example:

    t.file.add            #=> "Add file"
    t.file.delete('Test') #=> "Delete file Test"
    t.files(1)            #=> "One file"
    t.files(12)           #=> "12 files"
    
    l -12000.5          #=> "−12,000.5"
    l Time.now          #=> "2009-08-09 21:41"
    l Time.now, :human  #=> "now"
    l Time.now, :full   #=> "August 9th, 2009 21:41"
    
    # Base translation
    t.ok     #=> "OK"
    t.cancel #=> "Cancel"
  3. You can print user locale or available locales:

    "Your locale: " + r18n.locale.title
    "Select another: " + r18n.available_locales.map { |i| i.title }.join(', ')

License

R18n is licensed under the GNU Lesser General Public License version 3. You can read it in LICENSE file or in www.gnu.org/licenses/lgpl-3.0.html.

Author

Andrey “A.I.” Sitnik andrey@sitnik.ru