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

learn more… | top users | synonyms

0
votes
1answer
20 views

ActionController::UrlGenerationError in Devise::Registrations#create

I'm newbie in Rails and I don't know what to do with tis error, please help (with explanation): ActionController::UrlGenerationError in Devise::Registrations#create Showing ...
0
votes
0answers
9 views

Is there any way to know which files Rails is opening when doing I18n?

I'm having trouble with translations (I18n) in Rails 3. There are a couple of words that I can't realize from where Rails/I18n is trying to read the translation. My form has a simple_form inside a ...
0
votes
1answer
13 views

[SOLVED]Rails - exception I18n::InvalidLocale in a strange place

Sometimes rails is beautiful, but sometimes it's terrible. Especially when you got strange exception I have 3 simple models /app/models/specification_type.rb class SpecificationType < ...
0
votes
1answer
21 views

Rails 4 translations.js with i18n-js gem not updating

I tried using the asset pipeline instructions for the i18n-js gem but that didn't work. A previous developer used the gem and generated the translations.js file somehow but then completely removed ...
0
votes
1answer
25 views

Rails I18n translations scoping

Writing a fully translated app can become tedious. Is there a way to set a default translation scope for the current context ? Example : I am writing inside a partial _deadlines.html.erb in the ...
0
votes
0answers
20 views

Translate custom model

I have a non-activerecorddata search model (which I use for filtering/searching other models). class DataSearch extend ActiveModel::Translation attr_reader :params def entity_id ...
0
votes
1answer
44 views

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: ...
0
votes
0answers
20 views

Rails i18n translation bug in underscore model attribute

When I translate errors generate from validations, problem appear only in underscore name: <label for="customer_last_name"><%= t('form.lastname') %></label> <%= f.text_field ...
1
vote
1answer
27 views

How to make Rails infer english translations from YAML translation key names automatically?

Is there a way to enable Rails to infer the english translations from the key names automatically? Currently I have to explicitly write the translation, because otherwise it would just output en, ...
0
votes
1answer
14 views

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 ...
0
votes
1answer
20 views

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 ...
2
votes
1answer
18 views

I18n locale disregarding fallbacks

I asked a previous question regarding locale-setting. I am trying to set up fallbacks of various Norwegian languages to Norwegian Bokmal (:nb). The desired behaviour is that if a browser passes nn or ...
0
votes
1answer
33 views

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. ...
0
votes
0answers
26 views

String based on interpolation value with rails-i18n globalize

In my rails app, I use globalize and have the following translation key: en.yml participated: one: "%{count} person already participated to %{teacher}'s workshop" fr.yml participated: one: ...
0
votes
2answers
35 views

Rails I18n-js: missing translation

I'm using I18n-js gem for localiztion of js files. I've installed it with help of gem Readme and it worked for the first time. The problem is when I add new translations to my translations.js file ...
0
votes
1answer
11 views

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 ...
0
votes
1answer
20 views

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 ...
0
votes
0answers
22 views

Rails I18n.fallbacks and enforce_available_locales

I have to set the locale in a specific controller action like this: def my_action I18n.locale = get_locale_from_this_object(@object) ... end The problem is that the object doesn't always refer ...
1
vote
2answers
35 views

How to configure locale aliases using i18n & rails?

I am working on a rails app (3.2.13) that is being translated into several languages, including (one of the 3 available flavours of) Norwegian. On public pages, the app uses the browser's language ...
0
votes
2answers
24 views

I18n with_translation and where condition

I'm trying to run a query on table Testimonials which has a Translation Table TestimonialTranslations. The Following query works like a charm: Testimonial.with_translations(I18n.locale).where(:id ...
1
vote
0answers
37 views

Way Rails does not raise I18n::MissingInterpolationArgument exception?

I created a dummy rails 4.1.5 application to show that I18n translate method doesn't raise I18n::MissingInterpolationArgument when the variable to be interpolated is not provided. It raises that ...
0
votes
1answer
10 views

Overwriting nested translations in I18n

Say I have the following en.yml: default_category: &default car: wheel: Wheel engine: Engine ... ... breaks: Breaks some_other_category: <<: *default What would ...
0
votes
1answer
22 views

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 ...
0
votes
0answers
13 views

I18n::InvalidPluralizationData how to track error?

I've seen similar posts about this but I still can't figure out where my error is coming from My I18n fails every time it needs to pluralize something in french. Everytime it's a similar error with ...
0
votes
0answers
14 views

route_translator gem generates a lot of sql queries to I18n backend

I am using the route_translator gem and this generates a lot of SQL queries in test-mode (production seems to be fine). This is my route translate initializer: RouteTranslator.config do |config| ...
0
votes
1answer
727 views

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? ...
0
votes
1answer
37 views

Ruby i18n.translate having :raise => true as default behaviour

When i call: t 'to_translate' method from my template, I would like it to raise an error without actually passing second parameter like this: t 'to_translate', :raise => true It would save me ...
0
votes
1answer
32 views

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 ...
0
votes
1answer
24 views

I18n translate rails constants of model

if I have a model with constants like class Topic < ActiveRecord::Base STATUS_DISABLED = 0 STATUS_ENABLED = 1 end how can I do to translate it with locales system? I would like things like ...
0
votes
0answers
16 views

Issue with i18n and mailer specifically subject and from

I have a very simple question: Why is not possible using nested yaml file to provide translations for a custom mailer made for devise? I mean, if I leave the translation key in the file en.yml in the ...
1
vote
2answers
35 views

Rails date i18n with custom formats not translating

I made an initializer named: 'date_formats.rb' and it looks like: Date::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013 DateTime::DATE_FORMATS[:default] = "%B %e, %Y" # November 3, 2013 14:22 ...
0
votes
1answer
66 views

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: ...
0
votes
0answers
15 views

Searchkick + Globalize

I would like specify to Searchkick in wich language to search. I installed Globalize to translate the field : title of my models. I only search in the default language, english. I didn't find ...
0
votes
1answer
24 views

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 <a href="/link/to/user">User</a> I'm using public_activity gem to ...
0
votes
1answer
36 views

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 ...
1
vote
2answers
46 views

Rails routes based on locale

I'm working on a multilingual rails app and I need the routes to be different for each locale. It's difficult to explain it like this for me, so I'll use an example: en: /en/pricing es: /es/precios ...
0
votes
0answers
17 views

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 ...
0
votes
0answers
14 views

Rails4 collection_select order based on I18n locale files

I have a form with collection_select that display translated_names of jobs. Everything works fine and translated_names of jobs are properly loaded inside the select field. I would like to sort them ...
0
votes
1answer
11 views

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 ...
0
votes
1answer
16 views

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 += ...
1
vote
1answer
152 views

Custom error message for invalid confirmation token in Devise for Rails

tl;dr: Is there a non-hacky way to get a custom full error message for just one attribute (confirmation_token) and error (:invalid) combination on a single model (User in this case)? Or to override ...
0
votes
1answer
34 views

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 ...
5
votes
2answers
56 views

Translate controller action_name in Rails 4

I want to translate my applications' views and as I'm using partial to render headers for each view like this: <%=t "#{controller.controller_name.capitalize} #{controller.action_name}" %> ...I ...
0
votes
0answers
35 views

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. ...
1
vote
1answer
132 views

Rails custom validation error messages on attributes of another model

I'm using using the following code in my model to insert a link into a validation error message: class Bar < ActiveRecord::Base has_many :foos validate :mode_matcher def mode_matcher ...
0
votes
0answers
40 views

Routes.rb is breaking my css/js

I am using i18n on rails and when i change the first version of my routes.rb to the second version,it happens that some of my css/js does not appear to work anymore...what am I doing wrong? or how can ...
0
votes
0answers
7 views

How to use (a workaround to use) locale as well as language in Rails?

I'm unable to find documentation on how to use locale as part of i18n in Rails, eg en_CA versus en, or es-ES versus es. See http://guides.rubyonrails.org/i18n.html where it talks about 'a pragmatic ...
0
votes
1answer
26 views

Rails Internacionalization datagrid

I install gem datagrid but cant translate this in i18n method or internacionalization I cant make this can anyone help me?
0
votes
0answers
48 views

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 ...
0
votes
1answer
46 views

returning specific values extracted from an hstore (Postgres + hstore_translate gem)

I am using hstore_translate within a Rails4 project to handle my I18n needs. Assume I have the following model: class Thingy < ActiveRecord::Base translates :name end with table defined in a ...