Questions tagged [globalize]

Globalize is the I18n de-facto standard library for model/data translation in Ruby on Rails. It replaces Globalize3 and works with both Rails 3 and Rails 4.

Globalize is the I18n de-facto standard library for model/data translation in Ruby on Rails. It replaces Globalize3 and works with both Rails 3 and Rails 4.

Globalize replaces the (no longer supported) Globalize3 gem and is targeted at ActiveRecord 4.x, but also supports ActiveRecord 3.x. It is compatible with and builds on the I18n API in Ruby on Rails and adds model translations to ActiveRecord.

Major version numbers in Globalize now correspond to those in ActiveRecord, so Globalize 3.x for ActiveRecord 3.x and Globalize 4.x for ActiveRecord 4.x.

134 questions
3
votes
1 answer

How to validate translations using locale or fallthrough accessors in mobility?

How can I validate a model with locale or fallthrough accessors with mobility gem using the accessors on creation or updating? Using mobility gem: v1.0.5 c = Category.new(name_en: 'Cat. 1', name_de: 'Kat. 1') c.valid? # => false c.errors # Should…
phlegx
  • 2,618
  • 3
  • 35
  • 39
3
votes
2 answers

rails_admin params[:query] in select field is ignored

Can't figure out how to filter nested association belongs to while search in rails admin. I have the following code in my rails_admin config in model. class Painting < ApplicationRecord ... rails_admin do configure :translations, :globalize_tabs …
zhisme
  • 2,368
  • 2
  • 19
  • 28
3
votes
1 answer

Rails - Could not find i18n-0.9.5 in any of the sources

I'm working on a Ruby website using MySQL and I was working on internationalization using Globalize. However, when I run rails g migration create_translation_for_articles The terminal displays the following: Could not find i18n-0.9.5 in any of the…
TamerB
  • 1,401
  • 1
  • 12
  • 27
3
votes
2 answers

Rails - Globalize and Permanent_record dependent: :destroy callbacks

In a Rails 4.2 project I use gem 'permanent_records' to handle records soft-deletion and gem 'globalize' for translations. Globalize sets the following relationships between the translated Model and the Translation Model (source): has_many…
davideghz
  • 3,596
  • 5
  • 26
  • 50
3
votes
1 answer

Globalize js inside angular component

Hi im trying to create a angular 4 application that supports L10n .I want to use globalize in the application .My component App component is below import { Component,OnInit } from '@angular/core'; import globalize from…
dockerrrr
  • 277
  • 1
  • 5
  • 17
3
votes
0 answers

Rails Globalize Gem + JSON Resources Gem

I have a project where I need to use internacionalization for table fields and to provide a jsonapi. To accomplish this I'm using the Globalize Gem and the JSON API Gem. This is the code for a simple model called category: class Category <…
Tiago
  • 673
  • 1
  • 8
  • 24
3
votes
0 answers

Thinking Sphinx : Multiple indices and Delta

Since I have a model with localized fields (using Globalize, I'd like to make localized search. I set up two indices on my model : ThinkingSphinx::Index.define :document, name: "document_fr", :with => :active_record, :delta => true do indexes…
LapinLove404
  • 1,939
  • 1
  • 21
  • 26
3
votes
1 answer

How to get a list of Globalized fields in model?

I use gems globalize and globalize_accessors for translating my models. Here is an example: # model.rb class Model < ActiveRecord::Base translates :title, :description globalize_accessors end I want to be able to retreive the list of fields…
firedev
  • 20,898
  • 20
  • 64
  • 94
2
votes
1 answer

ActiveAdmin Globalize create index filters

I'm using Globalize and ActiveAdmin, and I've now installed a gem from a fork of ActiveAdminGlobalize Everything that is described in the readme is working, but I'd like to add a filter to the Active Admin Index. So, for the model stuff.rb class…
Tiago
  • 673
  • 1
  • 8
  • 24
2
votes
1 answer

Cannot load gem installed using bundler in rails console

I am trying to install the latest version of Globalize gem - the only one compatible with Rails 5. To do that I have to install it from Github. So I added the following line to the Gemfile as suggested by the Readme file: gem 'globalize', git:…
wael34218
  • 4,860
  • 8
  • 44
  • 62
2
votes
1 answer

How to use Globalize with Angular CLI

How do I load the Globalize library along with the CLDR data in an Angular app generated from angular cli. When I perform the following steps: npm install globalize cldr-data import {Globalize} from 'globalize'; in app.component.ts ng serve I get…
takeradi
  • 3,661
  • 7
  • 29
  • 53
2
votes
0 answers

Rails - adding scope to routes breaks Friendy Urls

I recently added localizations scope to my routes (like described in Railscasts PRO #138), because I need them to look like this: localhost/en/admin/posts localhost/en/admin/posts/happy-new-post/edit But adding a scope throws an error: can't find…
mohnstrudel
  • 639
  • 8
  • 22
2
votes
1 answer

Globalize / Cldr : Globalize.formatDate(new Date(), {datetime:"long"}) resulted in something like "16. januar 2017. 13.30.17 GMT+1"

I have ASP.NET MVC 5 application, and my Globalization / Validation (Globalize 1.2.2) loads are:
2
votes
1 answer

How to check if Globalize has used a fallback

I am using: gem 'rails', '4.0.0' gem 'globalize', '~> 4.0.2' In my Image.rb model I have two columns I want translate (English and German): translates :name, :description In application.rb I set: config.i18n.fallbacks = true Everthing works fine.…
user929062
  • 807
  • 4
  • 12
  • 33
2
votes
1 answer

Rails: rename globalize column

The rails globalize gem docs are great, but I can't find a solution, what I have to do, when I want to rename a column. Last Year I did that, to add the translation fields. def up remove_column :news, :name News.add_translation_fields!…
Archer
  • 1,062
  • 1
  • 13
  • 32
1
2
3
8 9