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

rails I18n wrong parameter order in route (id as locale and id is nil)

I want to internationalize an external code (see github) with i18n for rails. I have read the guide for Rails Internationalization (I18n) API. Translating the text is not a problem, but the underlying code seems not to work properly anymore in all…
0
votes
1 answer

RubyOnRails - Does not keep the selected language when I refresh the page

In development mode all work fine. But not in production mode on heroku. When I select a locale and I refresh the page, it displays language by default half the time and the language I selected otherwise. I do not know what to do. I tried to clear…
Kevin
  • 143
  • 8
0
votes
1 answer

I18n to call different Model Attribute depending on Locale?

So I am building an on-line shop and I want two language options, English and Spanish. I am using I18n as you would normally do for all my static text and headings ect. But, I have a products Model that can have new Products created for listing on…
IT_puppet_master
  • 702
  • 5
  • 20
0
votes
0 answers

Change locale in rails outside session

I am learning Rails and I want to setup localisation for my app. I can do it without any issue for each user (i.e. each user can select their language and the app changes to the selected language) but I want to add the option to change language even…
Juanpe Araque
  • 579
  • 1
  • 4
  • 16
0
votes
0 answers

Move Rails 4 translations to PostgreSQL

I need to store locales of Rails app in DB. And give access for admin to edit locales from admin area of app (activeadmin). This is idea what I have. Create file with locales named, e.g. en.yml.lock. Write translations in this file (duplicate to…
mxgoncharov
  • 475
  • 2
  • 7
  • 15
0
votes
1 answer

Why I18n translations change when local variable with a selected translation key changes?

This is above me today. Hope someone can explain this to me! Assume you have a rails project with a en.yml file with the following contents: en: foo: foo: foo bar: bar Assigning the results of I18n.t(:foo) to a local variable, you get a…
user2108865
0
votes
0 answers

Extract json object to .yml translation file on Ruby on Rails

I have json object as below { 'questions.new': 'New Question', 'questions.other.recent': 'Recent', 'questions.other.old': 'Old' } I need to write this data to .yml file by using Ruby on Rails method. My expected file is as below en: …
huynhthinh
  • 37
  • 5
0
votes
1 answer

Custom pluralization in Ruby on Rails

I have a month range string, and want to pluralize it that way: I18n.t :range, min: min_date, max: max_date If min_date and max_date are equal, it should translate to %{min_date} to %{max_date}, but if they are different I want to show just…
Talysson
  • 1,363
  • 1
  • 9
  • 13
0
votes
1 answer

Rails render template messes up I18n scope

The controller: class ProfilesController < ApplicationController def show end end When controller responds show action as JS, show.js.erb contains the following: $('#main-content').html('<%= j( render( template: "profiles/show.html.erb" ) )…
0
votes
1 answer

hstore_translate existing data migration

I've added hstore_translate to a Rails4 project with existing data. class Product < ActiveRecord::Base translates :subtitle, :description end config.i18n.fallbacks = true class AddTranslationColumnsToProducts < ActiveRecord::Migration def…
0
votes
1 answer

I18n error in one file, but not another in same directory

I have two lib classes in my rails project. Both print out an error using the same syntax I18n.t('.config_error') One file it succeeds, the other file it fails with this error: I18n::InvalidLocaleData: can not load translations from…
Busch
  • 857
  • 10
  • 29
0
votes
1 answer

How to specify the I18n locale for registered users

I'm making an app that uses globalize to translate the db. I need to be able to create an UI for admins to be only able to access specific locales so they can translate them. I am thinking two ways to do this. 1- use Pundit (see below), or 2- after…
0
votes
1 answer

simple_form_for with localized, scoped routes and Mongoid (missing required keys: [:id])

I have a _form.html.haml partial for a model FileType that I want to render in my new.html.haml and edit.html.haml view. = simple_form_for [:document_manager, file_type] do |f| ... When I render this partial in the new view, this works, but…
tbraun89
  • 2,246
  • 3
  • 25
  • 44
0
votes
1 answer

rails i18n passed params get lost

I started using i18n with my app, but all the pages that i access by passing a parameter with the link_to isn't working. so, let's say i'm currently on this page /ar/browse?type=art that i got to via clicking on this link_to <%= link_to "/ART/",…
0
votes
1 answer

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 the i18n-js gem and configuration options except…
Pavan Katepalli
  • 2,372
  • 4
  • 29
  • 52