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

Timeout loading translations from YML file with I18n

I'm getting lots of these I18n::InvalidLocaleData errors when trying to load translation files on heroku: I18n::InvalidLocaleData can not load translations from /app/config/locales/pt.yml: # The files exist in our…
ckbhodge
  • 913
  • 2
  • 9
  • 19
0
votes
1 answer

How do I internationalize a link_to confirmation message?

Exactly as the title suggests. How would I internationalize something such as this: = link_to t('.close'), topic_path(@topic, topic: { closed: '0' }), method: :put, confirm: 'Are you sure you want to close this topic?', class: 'btn…
Dan Rubio
  • 4,709
  • 10
  • 49
  • 106
0
votes
1 answer

Translate path with rails i18n

I have a rails 4.0.0 app running with friendly_id and globalize (even if freindly_id and globalize might not matter for this question). Part of my routes.rb is: scope "(:locale)", locale: /en|de/ do resources :mainclasses, :path => :types end I…
0
votes
1 answer

How to localize i18n urls with Rails without using a gem

My website is localized in two languages right now: www.website.com/book www.website.com/de/book I just use the "de" local, not the "en" in the url. Is there a way to change the de-urls to e.g. www.website.com/de/buch without using an extra gem? I…
0
votes
1 answer

unable to add attribute value on Error message

i have a custom validation method on user_calendar model: class UserCalendar < ActiveRecord::Base belongs_to :user validate :should_match_company_calendars ... private def should_match_company_calendars day_company_calendars =…
ntonnelier
  • 1,539
  • 3
  • 23
  • 49
0
votes
1 answer

How to lookup i18n translations in nested yaml file in Rails 4.2?

Under 4.1.4 "Lazy" Lookup, if you have the following dictionary: es: books: index: title: "Título" you can look up the books.index.title value inside app/views/books/index.html.erb template like this (note the dot): <%= t '.title'…
Nona
  • 5,302
  • 7
  • 41
  • 79
0
votes
1 answer

Print all translations of a column in same Rails Show Action

I'm trying to do a weird thing: In a web with I18n I pretend to print the slug of current page. ModelName.friendly.find(params[:id]).slug.to_s It works, it renders not only the slug but any column I want. But I need to print also the slug of…
Ricardo Castañeda
  • 5,746
  • 6
  • 28
  • 41
0
votes
1 answer

Allow locale switching Rails I18n HTTP_ACCEPT_LANGUAGE

I want to get the language of non sign in user from the browser for this i have this code in my application controller def set_locale if user_signed_in? && !current_user.language.blank? I18n.locale = current_user.language else …
0
votes
1 answer

Load locales/I18n files from Ruby gem into Rails

I have a ruby gem that I'm working on that includes some locale/I18n files that I would like to be loaded if and when the gem is used by Rails. I've looked around a little and it looks like I need to provide a Railtie - I've found some examples here…
0
votes
1 answer

Route issues with ActionMailer "Missing required keys: [:locale]"

I've recently added multilanguage support to my rails app, but now all my mailers stopped working... class NotificationUserMailer < ActionMailer::Base default from: 'control-de-asistencia@email.us' def send_welcome_mail_to(user_id, password) …
gustavoca
  • 148
  • 12
0
votes
1 answer

I18n Show text with link inside

I'd like to a text that looks like: You created a new User But what i get is just a plain text: You crated a new User I'm using public_activity gem to track changes inside my app. Here is my…
gustavoca
  • 148
  • 12
0
votes
1 answer

Change locale name in Rails 4

I have a multilingual Rails app where I would like to include also a Czech locale. My problem is, that locale in Rails for Czech is cs while a more common abbreviation for Czech is cz. My client requires their locale (which is used in URI) to be cz.…
0
votes
0 answers

Rails i18n ActiveRecord backed

I want to store web site translations in ActiveRecord, because it easy to edit in admin area. I found only one solution: https://github.com/svenfuchs/i18n-active_record But it is completable with 3rd version of rails and last commit was one year…
Voldemar Duletskiy
  • 981
  • 1
  • 11
  • 30
0
votes
1 answer

i18n-active_record and protected_attributes

When I am trying add new translation: I18n::Backend::ActiveRecord.new.store_translations(:encoding, :key => value) I have following error: ActiveModel::MassAssignmentSecurity::Error: Can't mass-assign protected attributes for…
Voldemar Duletskiy
  • 981
  • 1
  • 11
  • 30
0
votes
1 answer

Rails localization "lazy" lookup

I have such views structure: views layouts visitors _footer.html.haml _header.html.haml visitors.html.haml In my config/application.rb I've added config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**',…
kovpack
  • 4,905
  • 8
  • 38
  • 55