gettext_column_mapping 0.2.6 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.6
1
+ 1.0.0
@@ -19,7 +19,7 @@ module GettextColumnMapping
19
19
  end
20
20
 
21
21
  def map_attribute(obj,key)
22
- self[obj.name.underscore][:column_names][key] rescue key.to_s.capitalize
22
+ self[obj.name.underscore][:column_names][key] || key.to_s.capitalize rescue key.to_s.capitalize
23
23
  end
24
24
 
25
25
  def translate_key?(obj,key)
@@ -43,7 +43,7 @@ module GettextColumnMapping
43
43
  end
44
44
 
45
45
  def translate_key_for_column?(klass, column)
46
- column_attributes_translation(klass.name)[column]
46
+ column_attributes_translation(klass.name).include?(column.to_s)
47
47
  end
48
48
 
49
49
  def each_config(&block)
@@ -78,7 +78,7 @@ module GettextColumnMapping
78
78
  end
79
79
 
80
80
  def column_attributes_translation(klass_name)
81
- @column_attributes_translation[klass_name] ||= (attributes_translation(klass_name) && attributes_translation(klass_name)[:columns]) || []
81
+ @column_attributes_translation[klass_name] ||= ((attributes_translation(klass_name) && attributes_translation(klass_name)[:columns]) || []).map(&:to_s)
82
82
  end
83
83
 
84
84
  end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
2
  test:
3
3
  database: gettext_column_mapping
4
- adapter: mysql
4
+ adapter: mysql2
5
5
  host: localhost
6
6
  username: root
7
7
  password:
data/test/mapper_test.rb CHANGED
@@ -28,8 +28,8 @@ class UtilisateurTest < ActiveSupport::TestCase
28
28
  end
29
29
 
30
30
  def test_map_attribute
31
- assert 'Label', GettextColumnMapping.mapper.map_attribute(NotMapped,'label')
32
- assert 'Label', GettextColumnMapping.mapper.map_attribute(Categorie,'label')
31
+ assert_equal 'Libelle', GettextColumnMapping.mapper.map_attribute(NotMapped,'libelle')
32
+ assert_equal 'Label', GettextColumnMapping.mapper.map_attribute(Categorie,'libelle')
33
33
  end
34
34
 
35
35
  def test_translation
@@ -6,7 +6,7 @@
6
6
  msgid ""
7
7
  msgstr ""
8
8
  "Project-Id-Version: version 0.0.1\n"
9
- "POT-Creation-Date: 2010-07-06 10:30+0200\n"
9
+ "POT-Creation-Date: 2010-12-30 16:26+0100\n"
10
10
  "PO-Revision-Date: 2010-07-05 11:51+0200\n"
11
11
  "Last-Translator: <hery@rails-royce.org>\n"
12
12
  "Language-Team: French\n"
@@ -7,7 +7,7 @@
7
7
  msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: version 0.0.1\n"
10
- "POT-Creation-Date: 2010-07-06 10:30+0200\n"
10
+ "POT-Creation-Date: 2010-12-30 16:26+0100\n"
11
11
  "PO-Revision-Date: 2010-07-05 11:48+0200\n"
12
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
data/test/static/data.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  # coding: utf-8
2
2
  #DO NOT MODIFY! AUTOMATICALLY GENERATED FILE!
3
- s_('Model|Category')
4
- s_('Model|Category|Label')
5
- s_('Model|Division')
6
- s_('Model|Division|Label')
7
- s_('Model|User')
8
- s_('Model|User|First name')
9
- s_('Model|User|Last name')
10
- s_('Model|User|Gender')
11
- s_('Data|Model|Category|Sport|Label|Football')
12
- s_('Data|Model|Category|Sport|Label|World Cup')
13
- s_('Data|Model|Category|Event|Label|Football')
14
- s_('Data|Model|Category|Event|Label|World Cup')
3
+ s_("Model|Category")
4
+ s_("Model|Category|Label")
5
+ s_("Model|Division")
6
+ s_("Model|Division|Label")
7
+ s_("Model|User")
8
+ s_("Model|User|First name")
9
+ s_("Model|User|Last name")
10
+ s_("Model|User|Gender")
11
+ s_("Data|Model|Category|Sport|Label|Football")
12
+ s_("Data|Model|Category|Sport|Label|World Cup")
13
+ s_("Data|Model|Category|Event|Label|Football")
14
+ s_("Data|Model|Category|Event|Label|World Cup")
15
15
  #DO NOT MODIFY! AUTOMATICALLY GENERATED FILE!
metadata CHANGED
@@ -3,10 +3,10 @@ name: gettext_column_mapping
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
+ - 1
6
7
  - 0
7
- - 2
8
- - 6
9
- version: 0.2.6
8
+ - 0
9
+ version: 1.0.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - hallelujah
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-28 00:00:00 +02:00
17
+ date: 2010-12-30 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -27,14 +27,12 @@ extensions: []
27
27
  extra_rdoc_files:
28
28
  - README.rdoc
29
29
  files:
30
- - .gitignore
31
30
  - MIT-LICENSE
32
31
  - README.rdoc
33
32
  - Rakefile
34
33
  - VERSION
35
34
  - examples/config/column_mapping.yml
36
35
  - examples/config/gettext_db_extract.yml
37
- - gettext_column_mapping.gemspec
38
36
  - init.rb
39
37
  - install.rb
40
38
  - lib/gettext_column_mapping.rb
@@ -83,8 +81,8 @@ homepage: http://github.com/hallelujah/gettext_column_mapping
83
81
  licenses: []
84
82
 
85
83
  post_install_message:
86
- rdoc_options:
87
- - --charset=UTF-8
84
+ rdoc_options: []
85
+
88
86
  require_paths:
89
87
  - lib
90
88
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -111,19 +109,19 @@ signing_key:
111
109
  specification_version: 3
112
110
  summary: Translate your database columns with gettext
113
111
  test_files:
114
- - test/helper.rb
115
- - test/static/data.rb
116
- - test/static/pluralization.rb
117
112
  - test/activerecord_test.rb
118
- - test/mapper_test.rb
113
+ - test/db/migrate/001_create_utilisateurs.rb
114
+ - test/db/migrate/002_create_rubriques.rb
115
+ - test/db/migrate/003_create_categories.rb
116
+ - test/extend_lib_path.rb
119
117
  - test/fast_gettext_helper.rb
120
118
  - test/gettext_column_mapping_test.rb
121
- - test/extend_lib_path.rb
122
119
  - test/gettext_helper.rb
123
- - test/db/migrate/001_create_utilisateurs.rb
124
- - test/db/migrate/003_create_categories.rb
125
- - test/db/migrate/002_create_rubriques.rb
120
+ - test/helper.rb
121
+ - test/mapper_test.rb
126
122
  - test/models/categorie.rb
127
123
  - test/models/rubrique.rb
128
124
  - test/models/utilisateur.rb
125
+ - test/static/data.rb
126
+ - test/static/pluralization.rb
129
127
  - test/test_helper.rb
data/.gitignore DELETED
@@ -1,6 +0,0 @@
1
- *.swp
2
- *~
3
- test/locale/
4
- coverage
5
- rdoc
6
- pkg
@@ -1,105 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{gettext_column_mapping}
8
- s.version = "0.2.6"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["hallelujah"]
12
- s.date = %q{2010-10-28}
13
- s.description = %q{Translate your database columns with gettext}
14
- s.email = %q{hery@rails-royce.org}
15
- s.extra_rdoc_files = [
16
- "README.rdoc"
17
- ]
18
- s.files = [
19
- ".gitignore",
20
- "MIT-LICENSE",
21
- "README.rdoc",
22
- "Rakefile",
23
- "VERSION",
24
- "examples/config/column_mapping.yml",
25
- "examples/config/gettext_db_extract.yml",
26
- "gettext_column_mapping.gemspec",
27
- "init.rb",
28
- "install.rb",
29
- "lib/gettext_column_mapping.rb",
30
- "lib/gettext_column_mapping/backends/base.rb",
31
- "lib/gettext_column_mapping/backends/gettext_activerecord.rb",
32
- "lib/gettext_column_mapping/backends/gettext_i18n_rails.rb",
33
- "lib/gettext_column_mapping/initializer.rb",
34
- "lib/gettext_column_mapping/mapper.rb",
35
- "lib/gettext_column_mapping/model_attributes_finder.rb",
36
- "lib/gettext_column_mapping/parent_level.rb",
37
- "lib/gettext_column_mapping/parent_level/attr_methods.rb",
38
- "lib/gettext_column_mapping/parser.rb",
39
- "lib/gettext_column_mapping/parser/yaml.rb",
40
- "lib/gettext_column_mapping/railtie.rb",
41
- "lib/gettext_column_mapping/tasks.rb",
42
- "lib/gettext_column_mapping/version.rb",
43
- "tasks/gettext_column_mapping.rake",
44
- "test/.gitignore",
45
- "test/activerecord_test.rb",
46
- "test/config/column_mapping.yml",
47
- "test/config/database.yml",
48
- "test/config/parent_level_column_mapping.yml",
49
- "test/db/fixtures/categories.yml",
50
- "test/db/fixtures/rubriques.yml",
51
- "test/db/migrate/001_create_utilisateurs.rb",
52
- "test/db/migrate/002_create_rubriques.rb",
53
- "test/db/migrate/003_create_categories.rb",
54
- "test/extend_lib_path.rb",
55
- "test/fast_gettext_helper.rb",
56
- "test/gettext_column_mapping_test.rb",
57
- "test/gettext_helper.rb",
58
- "test/helper.rb",
59
- "test/log/.gitkeep",
60
- "test/mapper_test.rb",
61
- "test/models/categorie.rb",
62
- "test/models/rubrique.rb",
63
- "test/models/utilisateur.rb",
64
- "test/po/fr/gettext_column_mapping.po",
65
- "test/po/gettext_column_mapping.pot",
66
- "test/static/data.rb",
67
- "test/static/pluralization.rb",
68
- "test/test_helper.rb",
69
- "uninstall.rb"
70
- ]
71
- s.homepage = %q{http://github.com/hallelujah/gettext_column_mapping}
72
- s.rdoc_options = ["--charset=UTF-8"]
73
- s.require_paths = ["lib"]
74
- s.rubygems_version = %q{1.3.7}
75
- s.summary = %q{Translate your database columns with gettext}
76
- s.test_files = [
77
- "test/helper.rb",
78
- "test/static/data.rb",
79
- "test/static/pluralization.rb",
80
- "test/activerecord_test.rb",
81
- "test/mapper_test.rb",
82
- "test/fast_gettext_helper.rb",
83
- "test/gettext_column_mapping_test.rb",
84
- "test/extend_lib_path.rb",
85
- "test/gettext_helper.rb",
86
- "test/db/migrate/001_create_utilisateurs.rb",
87
- "test/db/migrate/003_create_categories.rb",
88
- "test/db/migrate/002_create_rubriques.rb",
89
- "test/models/categorie.rb",
90
- "test/models/rubrique.rb",
91
- "test/models/utilisateur.rb",
92
- "test/test_helper.rb"
93
- ]
94
-
95
- if s.respond_to? :specification_version then
96
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
97
- s.specification_version = 3
98
-
99
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
100
- else
101
- end
102
- else
103
- end
104
- end
105
-