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 4 - Handling Datetime

I am experiencing strange things when handling Datetime in Rails. In my models, I have a datetime column using Postgres. My application's Time Zone is set to Central America. However, I am developing in Taiwan's Time Zone (in case it makes a…
0
votes
1 answer

Use different translations for same ActiveModel class in different contexts?

I know it is a slight anti-pattern to do this, nevertheless sometimes it just would be a much easier solution than implementing different logic classes or fully-functional decorators/form-objects for just a tiny bit of difference. Given i have a…
maxigs
  • 866
  • 6
  • 16
0
votes
1 answer

How to integrate the language in the URL in Sinatra

I have an application with many languages and now I want to integrate in the URL the language. Something like this: https://example.com/en/main/cars https://example.com/fr/main/cars and so on. The application works perfectly for every language, only…
karlihnos
  • 415
  • 1
  • 7
  • 22
0
votes
1 answer

Translates I18n tag in js in rails app

How do I set the refresh js file when you change the language? I have translation files in config/locales/en.yml and pl.yml and in vendor/assets/javascripts/file.js.erb i have console.log("<%= I18n.t('test.test') %>") I included js in…
Adrian
  • 532
  • 1
  • 7
  • 16
0
votes
0 answers

Translate a value in Ruby on Rails

I have a model called State and its attribute is name from Type String. There are currently two values I want to assign: "Imported" and "Archived". After creating a document I set state via controller to "Imported". In the Spanish version it should…
0
votes
1 answer

Selectivley escape translation of certain parts/helper methods

I use the helper method time_ago_in_words extensively, and it works as expected with I18n. But in some parts of the application, I just want the default english. Is there anyway to escape translation on selected methods/areas of an application?
Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232
0
votes
1 answer

How to translate string with custom parameters set?

I have script that write log messages like this: translation_template Parameters amount and names may be various. Message, parameters names and values I gets using regular expression, after that I have…
General Failure
  • 2,421
  • 4
  • 23
  • 49
0
votes
3 answers

Rails translation performance impact <%= raw t( vs. <%= t(

I am building a multilingual application using rails-i18n Ruby on Rails. Most of content (and DB entries) I have to translate is pure text, though part of it has some embedded html. I was thinking of using <%= raw t('translation_key') %> instead of…
Pippo
  • 11
  • 2
0
votes
1 answer

Rails internationalization issue

I have the following file structure: models/modules/survey/survey.rb and controllers/modules/survey/surveys_controller.rb I am having the internationalization for Survey model working: pl: activerecord: models: …
Andrey Deineko
  • 51,333
  • 10
  • 112
  • 145
0
votes
1 answer

Rails 4 Manage File based Translations at Admin End

I am working on a rails website and I need to make it multilingual. I have created yml files for the languages needed for translation. What I want is to provide the Admin access to files to edit them instead of browsing through the files, by a…
0
votes
1 answer

Rails i18n helpers

Rails helpers require me to have a i18n key for every model that I have. Example: en: helpers: label: employee: email: 'E-mail' password: 'Password' remember_me: 'Remember…
0
votes
0 answers

Converting Rails 4 App to Engine changes i18n locale namespacing causing I18n::MissingTranslationData errors

Converted my Pfoodler app to an engine. The Pfoodler engine is mounted in a test app. So far so good. Rails server launches and test app loads. When I start the Pfoodler engine, it throws an error: translation missing:…
Elvn
  • 3,021
  • 1
  • 14
  • 27
0
votes
1 answer

Haml pass localized variable to partial

I'm rendering a Haml partial in my application and I'd like to localize a parameter I'm passing in. So instead of = render 'form', user: @admin_user, roles: @roles, button_name: 'non localized text' I'd like to have something like = render…
tpei
  • 671
  • 9
  • 26
0
votes
1 answer

Does Rails Offer an API for Rendering A Translated Model Name with Count

I have my model names declared in config/locales/models.en.yml: en: activerecord: models: news_item: zero: No News Items one: News Item other: News Items I know I can get the correctly pluralized…
Undistraction
  • 42,754
  • 56
  • 195
  • 331
0
votes
1 answer

Rails Spree changing default_locale only work partially

At first I tried to change the locale to :th. Then I change it back and part of the website remains :th, while some part change back to :en. I change the default locale in config/application.rb with the code below: config.i18n.default_locale =…
harinsa
  • 3,176
  • 5
  • 33
  • 53