Questions tagged [rails-i18n]

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

0
votes
0answers
27 views

how to have i18n working with shared partial caching

All my app have been transform to work with i18n but, the last thing i need is to cache the partails for each language. I've already seen some method to cache like this : <% cache([I18n.locale, ...
1
vote
1answer
50 views

Ruby/Rails How to parse datetime from russian string

I need to parse date\time from string in russian. Example: 14:24, 19 мая 2019.
0
votes
1answer
42 views

Displaying the date pattern string in Rails i18n localization

I'd like to get the template string of the localized date format in Rails. What I'm going for: date_in_us = get_date_string(:en) # 'mm/dd/yyyy' date_in_gb = get_date_string(:en-gb) # 'dd/mm/yyyy' So ...
0
votes
1answer
22 views

How to change image according to language choice (i18n gem in Rails)?

I am willing to change a picture based on the choice of the language. It is because my image contains some text and I made three different versions of the image according to language choice (Dutch, ...
0
votes
1answer
8 views

Getting Globalize and autocomplete to work together

Using globalize gem to manage translations with autocomplete, there is a situation where a number of hooks need to be properly set. Note: this does not use hstore AFAIK. I have not managed to find a ...
0
votes
1answer
22 views

How to translate ActiveStorage attribute

My model, Order, has many texts, and each text can have one attached document (has_one_attached(:document)). Sometimes, the base error is Texts document, sometimes document... I would like to ...
0
votes
0answers
22 views

Engine and Namespaces with i18n en.yml

I'm having troubles mainly with namespacing an en.yml file within a rails engine. I think everything is loading right, put before_intialization in the engine file than in my application controller set ...
2
votes
2answers
57 views

Rails 5: How do I reference I18n translations from another yaml config file?

I have a config file: # config/meta.yml base_meta: title: 'Top 10 Cats' It has an corresponding initializer: # config/initializers/meta.rb META = YAML.load_file("#{Rails.root.to_s}/config/meta....
1
vote
1answer
45 views

Escape dot (.) from I18n translation look up

Is there anyway I can escape the I18n dot? I have keys that contain dots and can't seem to figure out a way to do a lookup correctly. Thanks
0
votes
0answers
14 views

ActionView Error when deployed to Heroku relating to i18n

Code works in development environment. When deployed to Heroku, logs show error ActionView::Template::Error (undefined method...). This is on the show, edit action and seems to be related to the i18n ...
0
votes
0answers
33 views

undefined method `railties_load_path' for nil:NilClass

I am creating a production database, but when I run the rake db:create I get this error: rake db:create --trace ** Invoke db:create (first_time) ** Invoke db:load_config (first_time) ** Invoke ...
0
votes
2answers
35 views

Limiting no of locales during rails i18n-js

I am working on a ruby on rails web app in which we are using rails I18njs gem for js translations. On my browser source, I could see all locales' js translation keys are rendered. Is there any way to ...
1
vote
0answers
17 views

Devise locales pointing to previous release path

I am getting An I18n::InvalidLocaleData occurred in users#social_sign_in: can not load translations from /home/releases/20190221131459/config/locales/devise.en.yml: #<Errno::ENOENT: No such ...
0
votes
1answer
17 views

Use relative root for i18n in presenter files

Working with a file like app/presenters/foo.rb, I want to be able to have an i18n key foo.whatever and reference it inside foo.rb as I18n.t('.whatever'), in a way that's similar to doing it with views....
0
votes
1answer
23 views

RAILS - How to fix I18n NoTranslationAvailable when using ISO3166::Country

I'm using https://rubygems.org/gems/countries in a project and trying to get all countries names using a locale string for translations. The locale 'DE', 'NO' or others are coming from the Google OCR ...
1
vote
2answers
47 views

Loading a YML file in Rails, and maybe using a i18n file instead

I have a dropdown.yml file that stores all my dropdown values for my multi-select fields in my forms. It is not environment dependent, so I do not have :development, :production, etc. I would like ...
0
votes
1answer
25 views

Filtering Rails validation errors with multiple languages (I18n)

I want to intercept the validation errors thrown by Rails on a registration form. In English this works like this: if @user.save # Do whatever... else @errors = @user.errors.full_messages ...
0
votes
0answers
31 views

Losing params when changing locale

I am using I18 to manage translation, and I have a simple_form for collecting data from a user. Everything is working well except, if the user changes the language while he is doing the form, in that ...
0
votes
1answer
95 views

i18n file location and format for Named Spaced Form Object

I have a form object app/form_models/car_registration/basics.rb module CarRegistration class Basics < Base include ActiveModel::Model delegate :name, :name=, to: :vehicle end end ...
1
vote
3answers
75 views

Object must be a Date, DateTime or Time object. nil given

Object must be a Date, DateTime or Time object. nil given. Extracted source (around line #23): <td><%= localize(movie.release_date, format: :long) %></td> ...
0
votes
0answers
27 views

Flash not shown with i18n

My flash message doesn't show when I use i18n, but does when I just use a string. This is in the application controller. This works: def user_not_authorized(exception) policy_name = exception....
0
votes
2answers
43 views

Different date format and one locale

I use I18n.t('date.formats.default') for date formatting. The issue is that in different countries there are different date formats, but one english locale. For example '%m.%d.%Y' fo US and '%d.%m.%...
1
vote
1answer
23 views

Rails i18n does not translate from yml the relation name on plural

I have this scenario, the person object has aprice. When I try to destroy the price that is being used byperson, I can not because it is dependent :: restrict_with_error. (This is expected) I use ...
0
votes
1answer
90 views

Single YAML file VS multiple YAML files in different folders and subfolders

I am working on automating the translation workflow and improving the Localization process as a whole of a Rails website. I am using SimpleBackend so only YAML files are used for storing translations. ...
0
votes
1answer
146 views

How to find the i18n key from the value

I want to make a helper function which can take an English string as input and translate it to the desired language chosen by the user. As all the locale files would be having key in common so I am ...
2
votes
1answer
21 views

How to pass wrong value as argument in I18n using rails validates inclusion validation?

I want to validate inclusion in country_code field in my Country table. And I want to show specific error for the invalid record using I18n. My model: class Country < ApplicationRecord ...
0
votes
0answers
55 views

Using wildcards in rails I18n

Say I've got an app with multiple models, each having multiple attributes. Some of these attributes are validated, and if a form input is invalid then a flash message is displayed. For example, if I ...
0
votes
1answer
28 views

How can I pass on URL parameters to internal links in a Rails app? [duplicate]

So I've configured my Rails app to switch language settings using query parameters, such as localhost:3000/pages/show?lang=en. Now, how can I pass on this ?lang=en part to other links included in this ...
1
vote
1answer
25 views

Rails 5: 'humanize' phrases that start with an accented character doesn't capitalize them

Localization is working fine, as per the official documentation. However I have found that Rails' humanize method doesn't correctly capitalize the first character of a sentence if it's accented. For ...
0
votes
0answers
17 views

I18n locale. format with and without attribute name, depending on context. Error message in Simpleform, full error in logs

Here are two approaches to showing AR records # A: SHOW attribute name nb: errors: format: "%{attribute} %{message}" # B: HIDE attribute name nb: errors: format: "%{message}" I want B: ...
0
votes
1answer
20 views

Does the keys in internationalisation rails behaves different if they are of different case

The example is from rails docs: en: hello: "Hello world" Are the both different. Does the case of the keys matters? en: Hello: "Hello world"
7
votes
1answer
433 views

Rails 5 I18n default_locale and fallback locale

How do I set a fallback locale in Rails 5.2? Right now it prints ''(blank) for attribute names if not found in locale. I would like it to fallback to :en when that happens. Rails 5 specific? # ...
0
votes
1answer
15 views

How can I define a business specific spoken language with i18n?

I develop a Ruby on Rails 5 application in which I use I18n gem for views translations. Terms used in views are quite generic, and are supposed to meet all businesses. But for one specific customer, ...
0
votes
1answer
22 views

Get Rails current locale in ISO 15897 locale

I'd like to retrieve the current locale of my Rails application in ISO 15897 format. Any way to format the current locale into this format?
0
votes
1answer
123 views

Could not find i18n-1.1.1 in any of the sources (Bundler::GemNotFound) with Passenger

I recently updated to Ruby 2.5.3 and Rails 5.2.1. Here si the Gemfile: source 'https://rubygems.org' gem 'rails', '~> 5.2' gem 'bootstrap-sass' gem 'sassc-rails' gem 'coffee-rails', '~> 4.2' ...
0
votes
2answers
107 views

Controller I18n encoding

In a Rails controller, I'd like to compute an i18n message to be sent to front-end. I proceed as follow: flash[:notice] = I18n.t 'programs.update.program_saved' In my translation file (fr.yml), the ...
0
votes
0answers
31 views

How to test I18n module with module prepended in Rails?

I have a module that is prepended to I18n: require 'rails-i18n' module I18nExtension def translate_localization_format(locale, object, format, options) puts __method__ ... end end I18n:...
1
vote
0answers
78 views

What is a good way to localize Timezone abbreviations, when there is only one locale that needs a translation?

According to Does moment library support translation of time zone abbreviations like EST, IST etc, the only Timezone abbreviations that need to be translated are the following: en_US -----------------...
1
vote
2answers
33 views

Rails: Is there a built translation for “ago”?

Rails translate time ago with time_ago_in_words and documentation is this. time_ago_in_words(3.minutes.from_now) # => 3 minutes However, in our app, we use "ago": 3 minutes ago ...
0
votes
0answers
11 views

Alchemy CMS - Helper - Language Selector

Is there any helper function in Alchemy CMS for adding the language selector in the view?
0
votes
1answer
25 views

Rails 4 / i18n / can't pass the locales to another page

I'm making a simple website with a home page and a contact form. Now I'm trying to make it into 3 languages using the rails-i18n gem, and it was successful on the home page, but now I'm stuck with how ...
0
votes
0answers
29 views

Floating footer with switching languages in I18n RoR

Here's something that I've been struggling with for a long time which doesn't seem to go away. I have a gallery page with images. For the loading of the page, and images especially, I've inserted a ...
2
votes
2answers
196 views

How to pluralize human_attribute_name with Rails 5 and I18n?

I want to translate and pluralize an attribute name in my App. So, for the my api_key attribute, I have the translation "Clef API". I pluralize the attribute name with Mymodel.human_attribute_name(:...
0
votes
2answers
28 views

How can I see translations for the specific language in rails console? Using I18n?

I can see translations for the default language using the Rails console using this code: I18n.t('views.signup.company_info') But how can I see translations for the german language?
0
votes
0answers
22 views

Dynamic data translate with Internationalization

i have a rails app with almost 70 models inside it. I want to perform internationalization for my rails application. I know how to convert the static text, but what should i do for the dynamic text? ...
0
votes
0answers
35 views

ruby I18n date format breaks after a while in production

We have a large rails4-app in production on several client machines. Recently we discovered an odd bug. After some unknown time (can be hours) in the rails app the I18n.localize(date) breaks. The ...
0
votes
1answer
36 views

How to translate with I18n using active_model_attributes gem?

I am using the active_model_attributes gem to define attributes and use validations in classes that do not inherit from ActiveRecord. I am dealing with the errors when those validations fail. I am ...
0
votes
1answer
151 views

List of I18n locales are not loading on dev server

I am seeing a strange issue about I18n. When i call my endpoint locally i am able to see all the available list of locales and the endpoint loads successfully. (byebug) I18n.available_locales [:en, :...
2
votes
0answers
80 views

String interpolation in I18n for active record validation errors

I have a non-user-friendly validation error message that I want to override: Cannot delete record because dependent [unfriendly model names] exist where the association is has_many :...
6
votes
1answer
127 views

Rails i18n is showing two languages at the same time

I use two languages for a site, English and Danish. 1) I have a list of links that look like this: <%= link_to html_viewer_url(activity.course, activity), target: '_blank' do %> <%= t('....

http://mssss.yulina-kosm.ru