Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Translate your databases names
## Rails Engine
Using inside engine? Load tasks - `load 'tasks/i18n-tasks-ar.rake'` in your `Rakefile`

dont forget to set locales setting in either
'config/i18n-tasks.yml' or 'config/i18n-tasks-ar.yml'
locales = ['en']

[badge-version]: https://badge.fury.io/rb/tuberack.png
[badge-travis]: https://travis-ci.org/werein/i18n-tasks-ar.svg?branch=master
[badge-coveralls]: https://coveralls.io/repos/werein/i18n-tasks-ar/badge.png?branch=master
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/ar/attribute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class << self
#
def names
result = {}
Rails.application.eager_load! if Rails.env == 'development' rescue true
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]
Avoid using rescue in its modifier form.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

ActiveRecord::Base.descendants.each do |model|
result[model.name] = model.attribute_names
end
Expand Down
2 changes: 1 addition & 1 deletion lib/i18n/tasks/ar/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def self.reset

if file
config = YAML.load_file(file)
self.locales = config['locales']
self.locales = config['locales'] rescue ['en']
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using rescue in its modifier form.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

else
self.locales = ['en']
end
Expand Down
3 changes: 2 additions & 1 deletion lib/i18n/tasks/ar/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Ar
module Model
class << self
def names
Rails.application.eager_load! if Rails.env == 'development' rescue true
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]
Avoid using rescue in its modifier form.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

ActiveRecord::Base.descendants.map(&:name)
end

Expand Down Expand Up @@ -36,4 +37,4 @@ def final_hash lang
end
end
end
end
end