Questions tagged [rails-i18n]

Repository for collecting Locale data for Ruby on Rails I18n as well as other interesting, Rails related I18n stuff.

About

The Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single custom language other than English or for providing multi-language support in your application.

The process of "internationalization" usually means to abstract all strings and other locale specific bits (such as date or currency formats) out of your application. The process of "localization" means to provide translations and localized formats for these bits.

Links:

  1. Homepage
  2. Guide
778 questions
0
votes
1 answer

Should I prevent making I18n translation calls in models

This is a question merely about code style. I am working on a multilingual app in Ruby on Rails 4. My personal feeling tells me ideally to not do calls to I18n.t() in models, I just think model methods should be consistent, and not depending on…
Pelle
  • 6,423
  • 4
  • 33
  • 50
0
votes
0 answers

What is the best practical way of testing a multilingual application in rails?

Suppose that I have a rails app that has 4 languages those german, english, french and swedish. I want to test this app with rspec for all locales. At the moment I test it like below. I18n.available_locales = [:en, :de, :fr,:sv] describe "Example…
zeitnot
  • 1,304
  • 12
  • 28
0
votes
0 answers

Rails i18n nested translations with ActiveRecord backend

I know that I can create nested translations in i18n dictionary. e.g. en: bugs: index: new_label: "File a new bug" edit_label: "edit" delete_label: "delete" It works perfect with simple YAML-files. But what will be if I want…
mxgoncharov
  • 475
  • 2
  • 7
  • 15
0
votes
1 answer

I18n adding "-US" to the en locale

I'm trying to persist the URLs with the specific language (i.e. en, pt, etc.) but after setting it up, I keep getting 'en-US' instead of 'en'. (i.e. localhost:3000/en-us/apps instead of localhost:3000/en/apps). Not sure where I can change this…
2fools
  • 111
  • 2
  • 10
0
votes
1 answer

i18n set_locale is not registering

A rails3.2.18 application has the following application_controller method def set_locale if user_signed_in? I18n.locale = current_user.idioma.code.downcase else I18n.locale = params[:locale] || I18n.default_locale end …
Jerome
  • 5,583
  • 3
  • 33
  • 76
0
votes
1 answer

Multiple views inheriting the same translations

Right now I have a pirate.yml in locales with the following structure: pirate: posts: index: page_title: Some posts navigation: Some navs over here index_test: page_title: Some posts navigation: Some navs over…
Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232
0
votes
1 answer

Rails I18n redirect default language

I have a multi-language rails website created using the Rails I18n API with URLs like "example.com/en/about" or "example.com/de/about" or "example.com/en/contact" etc. This works fine as is, but I would like that if a user goes to…
user1583209
  • 1,637
  • 3
  • 24
  • 42
0
votes
1 answer

Rails internationalisation for web form validation

I am developing an application that would employ a server-side phone number validation for the various countries it is deployed in. As an example, the UK mobile numbers all contain 11 digits starting with 07. In another country the mobile numbers…
Nick
  • 2,924
  • 4
  • 36
  • 43
0
votes
1 answer

Using i18n with Bootstrap-Rails and Simple_Form

I have a Model named Variable scaffolded with name and description as variables. Its Index View is as follow: <%- model_class = Variable -%>
0
votes
1 answer

How to change the image inside an email according to user's country (Rails 4, devise 3)

I am using an image that contains text inside an email I send to users For example: I have a User table with a user_country attribute (for example France) and a method I use on the website to induce the language : module LocaleSetter …
Mathieu
  • 4,587
  • 11
  • 57
  • 112
0
votes
1 answer

How to make Rails I18n string partially safe

How to mark as not safe only the variable that is passed into the translation method, when using i18n gem in Ruby on Rails framework? For example: t( 'safe', default: 'Unsafe %{unsafe_variable} and safe %{safe_variable}', …
Dmitry Polushkin
  • 3,283
  • 1
  • 38
  • 44
0
votes
1 answer

Creating lorem ipsum translations for Rails I18n

I have a big Rails app that I've I18ned. It hasn't yet been translated to any language, but I extracted 99% of the strings into yaml. They come from all over the place - views, models, JS. There's that remaining 1%, and tracking it down is proving…
ezuk
  • 3,096
  • 3
  • 30
  • 41
0
votes
1 answer

t("website_title") nil after moving from Heroku Bamboo to Cedar

I just moved my working Heroku app from Bamboo to Cedar, and now it crashes with: Rendered devise/sessions/new.html.erb within layouts/application (4.6ms) ActionView::Template::Error (no implicit conversion of nil into String): 8: <%=…
Nicolas Raoul
  • 58,567
  • 58
  • 222
  • 373
0
votes
0 answers

Rails best practice: translations for in models and controllers

When I implement a translation for my rails apps, I often get to the point that I have defined some strings in the models or in the controllers that I also want to translate. For example in controllers the flash notices or alerts when I use…
0
votes
1 answer

phraseapp how to set the locale using rails 4

I have integrated the phraseapp(https://phraseapp.com) to my project, I am currently having a popup which opens when a website is opened,shows radio buttons for each language. When the user clicks on any radio button, I want to translate the project…
siva
  • 1
  • 2