i18n_model_translator 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a746825c89ec2e7e57fc815efc57f0e117b0f90
4
- data.tar.gz: 15e80dc47f970bb7b049f650e93672aa6bad564e
3
+ metadata.gz: b1f86bbbf38155b4e46ef40749bce7714746e81f
4
+ data.tar.gz: 6e1a099d52bd12e6a58c287d9505a3768b1ca26d
5
5
  SHA512:
6
- metadata.gz: 33b4be7e0f01d5bd92d591b43d63307415c67961d5bfb206d917c47583d2a6c623716779dd97219cb26984161fd9d70611417276fcb69b38e83828248d12f6f9
7
- data.tar.gz: 879c8e8f6af4465cd5c4184401afa2947b5b7a6927f1c327405d793bce8e5d846a12fd520afea054d1ccc33c2ff7e66bd7bb81e380ca39c740507d3f42ce8694
6
+ metadata.gz: d6477534171acee22fac970a550e9cbbb5d85db18bee84c904ae033b6b890cecfb9d7abd8320666c5916152b80369ceaed6547dad74d530c0bd58087d30a6f52
7
+ data.tar.gz: 3f31af8d606f7972b44274de2a664dbbdd0dc9f707920bdbec5cb6c4443f030ac740a903620924fbf1a02628fb74d21ec385b58db6b296e683510d19eabbf59d
data/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # I18nModelTranslator
2
2
 
3
3
  Gem that generates i18n model translations for existing models. If you have descriptive column names in english it will generate the following files for your models:
4
- config/locales/models/model_name/en.yml
4
+ config/locales/models/model_name/en.yml.
5
+ More details can be found [on the blog coding-is-art.com](http://coding-is-art.com/rails-model-translations/ "i18n Active Record Model translations"):
6
+
5
7
 
6
8
  This is an example outcome:
7
9
 
8
10
  ```
9
11
  en:
10
- active_record:
12
+ activerecord:
11
13
  models:
12
14
  webinar_presenter:
13
15
  one: Webinar presenter
@@ -63,6 +65,11 @@ This gem gives you four rake tasks to create the model i18ns:
63
65
 
64
66
  $ rake i18n_model_translator:print_all_models_to_file[model]
65
67
 
68
+ ## Attention ZSH Users
69
+
70
+ You need to escape the `[` and `]` like this:
71
+
72
+ $ rake i18n_model_translator:print_model\[model\]
66
73
 
67
74
  ## Contributing
68
75
 
@@ -9,8 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Jens Freiling"]
10
10
  spec.email = ["jcfrei@uni-koblenz.de"]
11
11
  spec.summary = %q{Generate I18n Model Translation Files}
12
- spec.description = %q{Yes...}
13
- spec.homepage = ""
12
+ spec.description = %q{Generate I18n Active Record Model Translation Files}
13
+ spec.homepage = "https://github.com/botularius/i18n_model_translator"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -6,11 +6,11 @@ module I18nTranslator
6
6
  class << self
7
7
 
8
8
  def generate_model_translation(model, locale)
9
- active_record_hash = {active_record: {}}
9
+ active_record_hash = {activerecord: {}}
10
10
  names = generate_model_names(model)
11
11
  attributes = generate_model_attributes(model)
12
- active_record_hash[:active_record].merge!(names)
13
- active_record_hash[:active_record].merge!(attributes)
12
+ active_record_hash[:activerecord].merge!(names)
13
+ active_record_hash[:activerecord].merge!(attributes)
14
14
  {locale.to_sym => active_record_hash}.deep_stringify_keys.psych_to_yaml
15
15
  end
16
16
 
@@ -57,6 +57,7 @@ module I18nTranslator
57
57
  models = ActiveRecord::Base.descendants
58
58
  models.delete([ActiveRecord::SchemaMigration])
59
59
  models.reject! { |model| model.name.include?('HABTM') | !model.table_exists? }
60
+ return models
60
61
  end
61
62
 
62
63
  def write_to_file(model, locale, content)
@@ -1,3 +1,3 @@
1
1
  module I18nModelTranslator
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
@@ -4,12 +4,14 @@ namespace :i18n_model_translator do
4
4
 
5
5
  desc 'prints out the locale for one specific model'
6
6
  task :print_model, [:model] => :environment do |t, args|
7
- puts I18nTranslator::Models::ModelTranslation.generate_model_translation(args[:model].constantize, :en)
7
+ model = args[:model].classify.constantize
8
+ puts I18nTranslator::Models::ModelTranslation.generate_model_translation(model, :en)
8
9
  end
9
10
 
10
11
  desc 'prints out the model locale for the given model into /config/locales/models/model_name/en.yml'
11
12
  task :print_model_to_file, [:model] => :environment do |t, args|
12
- I18nTranslator::Models::ModelTranslation.write_model_translation(args[:model].constantize, :en)
13
+ model = args[:model].classify.constantize
14
+ I18nTranslator::Models::ModelTranslation.write_model_translation(model, :en)
13
15
  end
14
16
 
15
17
  desc 'prints out the locales for each model in the environment'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n_model_translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Freiling
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-16 00:00:00.000000000 Z
11
+ date: 2015-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,7 +108,7 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 3.2.0
111
- description: Yes...
111
+ description: Generate I18n Active Record Model Translation Files
112
112
  email:
113
113
  - jcfrei@uni-koblenz.de
114
114
  executables: []
@@ -134,7 +134,7 @@ files:
134
134
  - lib/i18n_model_translator/version.rb
135
135
  - lib/tasks/i18n_model_translator.rake
136
136
  - spec/spec_helper.rb
137
- homepage: ''
137
+ homepage: https://github.com/botularius/i18n_model_translator
138
138
  licenses:
139
139
  - MIT
140
140
  metadata: {}