Questions tagged [rails-i18n]

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

1
vote
2answers
35 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
21 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
28 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
81 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
46 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
25 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
38 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
22 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
42 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
86 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
20 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
41 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
20 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
314 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
13 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
20 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
108 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
80 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
26 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
65 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
9 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
24 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
27 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
161 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
27 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
21 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
33 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
34 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
129 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
69 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
122 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('....
0
votes
1answer
50 views

Rails I18n, interpolation when we ask to receive a hash object

I have an issue with the interpolation of value in my strings, i ask for the related_links strings and i receive a hash with the title and the url. this is my .yml user: subject: "New ...
0
votes
1answer
47 views

I18n translations not rendering in Datatable initializations?

I am trying to apply translations to a jquery dataTable. ie. myTable.DataTable({ language: { paginate: { next: (I18n.t('filters.paginate.next')), ...
0
votes
2answers
40 views

Compare between multiple Rails I18n YAML files to get them matching?

We have multiple I18n language files with thousands of lines in english, french and test language(x).. Is there an online parser that is able to match them up much easier than going line by line? ...
0
votes
1answer
47 views

How can I make ActiveStorage work within my locales?

How can I make Activestorage work within my locales like www.localhost:3000/es/ ? I had activestorage up and running. The images were saved and viewable in the views. Then, I added my locales to my ...
0
votes
2answers
119 views

MultiLingual In Single Page - Ruby on Rails

Is it possible to achieve using more than one language on loading a single page using I18n in Rails 5. Say for eg: I have a Q&A page where the question can be displayed in 'English' below which ...
1
vote
1answer
47 views

How can I specify Rails I18n locale an attribute translation common for all models?

I have in my es.ymllocale the following code: es: activerecord: models: courier: one: Repartidor other: Repartidores admin_user: one: Administrador ...
0
votes
1answer
40 views

Find all i18n tags in project and generate yml

I recently started a project that has a REALLY messed up locales file. I guess about 50% of the 10.000+ lines are locales from landingpages they're not using anymore. Is there a way to go over all ...
1
vote
1answer
652 views

Rails: translation missing error

I am trying to learn ruby on rails. And when doing internationalisation, I'm getting the error: translation missing: en.store.index.title_html Below is my en.yml file en: layouts: ...
0
votes
1answer
35 views

I18n translated values do not show up if changed from helper method rails

Hello not sure how to explain this but i will give it my best shot. I hv a model like this class Answer < ActiveRecord::Base EMPLOYMENT_TYPE = [ ['Employed', I18n.t('self_evaluation....
0
votes
1answer
63 views

Specific activerecord attributes becomes translation missing on production with Rails i18n

My default locale is :ja, and I have this for user.ja.yml: ja: activerecord: models: user: プロフィール attributes: user: account_id: アカウントID birth_day: 生年月日 ...
-2
votes
1answer
82 views

Translate rails nested attributes of a model with a prefix name

My project have two models with prefix name: Professional::Company and Professional::Service The Professional::Company model class Professional::Company < ApplicationRecord has_many :...
0
votes
0answers
97 views

Rails I18n: Render partial with variable

I wish to combine render function with a path declared in a .yml i18n file. My I18n .yml file follows this structure: pages: nav: items: - id: books link: 'books' - id: ...
0
votes
0answers
54 views

local_time gem: Where to place the I18n file?

I need to translate the string literals from the local_time gem in order to use it in my application. https://github.com/basecamp/local_time According to their docs, you can just manipulate this ...
0
votes
0answers
20 views

Setting locale separately on sign up page and after logging in

I have an app with user authentication where I want store locale in user model. I want to have language selection in two places - on the sign in page and in user profile page. I want the app to ...
0
votes
1answer
151 views

Rails i18n check if an item exists before display

I have a basic loop to display items from an i18n list: <% t('.items').each do |item| %> <p><%=item[:description]%></p> <p><%=item[:description_html]%>&...

http://mssss.yulina-kosm.ru