Questions tagged [i18n-gem]

Ruby internationalization and localization solution.

Ruby internationalization and localization solution.

For more information, see the official GitHub repository of the project.

105 questions
19
votes
5 answers

Organization of Locale Files in rails app

I currently have the following 4 files in my config/locales of my root application: -en.yml -de.yml -simple_form.en.yml -simple_form.de.yml In my application.rb which resides in a spec/dummy folder for testing the application gem I have the…
Jay
  • 3,012
  • 14
  • 48
  • 99
9
votes
3 answers

I18n without Rails?

just having troubles to make I18n to work without Rails environment: irb> require 'i18n' => true irb> I18n.load_path=Dir['/usr/lib/ruby/gems/1.9.1/gems/rails-i18n-0.6.6/rails/locale/en.yml'] =>…
David Unric
  • 7,421
  • 1
  • 37
  • 65
8
votes
1 answer

Dynamically loading I18n translations from gem into Rails Engine

I've created a gem (TranslationsGem) which I use in multiple projects (an engine and a Rails app). This gem sets up several hashes which are loaded into the I18n backend. A method #store_dynamic_translations sets up several hashes which are loaded…
richard
  • 14,050
  • 8
  • 37
  • 39
8
votes
1 answer

Rails I18n set_locale

I want to set the locale by the clients browserlocale request.env['HTTP_ACCEPT_LANGUAGE'] and by the URL. If a user visits a URL (e.g.: myapp.com) it should check the HTTP_ACCEPT_LANGUAGE and redirect to the right URL (e.g.: myapp.com/en - if the…
HaNdTriX
  • 28,732
  • 11
  • 78
  • 85
8
votes
3 answers

I18n load path not being set when running "bin/rake assets:precompile"!

I am using I18n-js, and my client side I18n.t calls all return a translation missing message when running in production. All is ok in development and test. The root of this issue appears to be in the asset pipeline. I18n.load_path does not contain…
Chris
  • 6,076
  • 11
  • 48
  • 62
7
votes
1 answer

Rails Internationalization: i18n look up with nested locales directories

I am trying to organize my localization files with a nested file structure so that it is easier to look up. I have followed Organization of Locale Files in rails app How do you structure i18n yaml files in Rails? but I am getting a translation…
7
votes
2 answers

Remove html tags from I18n "translation missing" messages

Consider the following code in a view: <%= link_to 'Delete!', item , :confirm => t('action.item.confirm_deletion'), :method => :delete %> It will normally come out as:
foolo
  • 804
  • 12
  • 22
6
votes
2 answers

best online services for i18n localization of existing rails project

Whats your opinion on translation services and which one would be a good fit for rails project with 2,3 but growing number of languages? Perhaps we can compile a list of services with pro's and con's. I have looked at: http://www.localeapp.com (…
5
votes
1 answer

How can I find out what locale-files are loaded by rails (including gems)?

I am introducing a new locale to my application, and copy all existing files in config/locales/.locale1.yml to config/locales/.locale2.yml. At first I expect that I18n.backend.send(:translations)['locale1'] would equal…
trueunlessfalse
  • 1,163
  • 10
  • 16
5
votes
2 answers

How to convert a localized string date to Ruby Date object?

I have a date which works fine when using it as English > Date.strptime("Aug 02, 2015", "%b %d, %Y") Sun, 02 Aug 2015 However when I use it another language es, that doesnt work. E.g. > Date.strptime("ago 02, 2015", "%b %d, %Y") ArgumentError:…
absessive
  • 1,121
  • 5
  • 14
  • 36
5
votes
3 answers

Heroku assets precompile fails for i18n-js

On pushing the Rails4 code to heroku I get the following error, this has started happening in last 2 days, which otherwise a smooth process Writing config/database.yml to read from DATABASE_URL -----> Preparing app for Rails asset pipeline …
sudhanshu
  • 462
  • 5
  • 17
5
votes
2 answers

Inheriting Rails i18n validation error messages in the subclass

What I understand Suppose I have a class with a handy validation like: User < ActiveRecord::Base validates :username, :format => {/regex/}, :message => :name_format end In this case, I can use i18n to make the error message translatable, by…
sheac
  • 592
  • 5
  • 12
5
votes
2 answers

Is there a standalone i18n library in Ruby?

In Ruby I can't find any localization modules. Are there any or should I use some external library? I have found I18n gem but I don't know if I can use it in standalone application (without Rails). Moreover I need some methods to localize floats and…
guest
  • 1,696
  • 4
  • 20
  • 31
4
votes
2 answers

How to internationalize a a ruby gem?

What is the best way to ship a gem with default i18n translations for strings used by it?
barbolo
  • 3,807
  • 1
  • 31
  • 31
4
votes
1 answer

Need To Add Internationalization To The Root Path - Ruby on Rails 3.2

I want my routes to have the format /locale/route instead of /route?locale=en, etc. I have the following in application_controller.rb before_filter :set_locale def default_url_options(options={}) { :locale => I18n.locale } end private …
1
2 3 4 5 6 7