gettext_i18n_rails 0.2.15 → 0.2.16

Sign up to get free protection for your applications and to get access to all the features.
data/Readme.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Translate via FastGettext, use any other I18n backend as extension/fallback.
4
4
 
5
- Rails does: `I18n.t('syntax.with.lots.of.dots')` with nested yml files
6
- We do: `_('Just translate my damn text!')` with simple, flat mo/po/yml files or directly from db
5
+ Rails does: `I18n.t('syntax.with.lots.of.dots')` with nested yml files
6
+ We do: `_('Just translate my damn text!')` with simple, flat mo/po/yml files or directly from db
7
7
  To use I18n calls add a `syntax.with.lots.of.dots` translation.
8
8
 
9
9
  [See it working in the example application.](https://github.com/grosser/gettext_i18n_rails_example)
@@ -112,7 +112,7 @@ Dynamic translations like `_("x"+"u")` cannot be fond. You have 4 options:
112
112
  ### Option C: Database
113
113
  Most scalable method, all translators can work simultaneously and online.
114
114
 
115
- Easiest to use with the [translation database Rails engine](http://github.com/grosser/translation_db_engine).
115
+ Easiest to use with the [translation database Rails engine](http://github.com/grosser/translation_db_engine).
116
116
  Translations can be edited under `/translation_keys`
117
117
 
118
118
  FastGettext::TranslationRepository::Db.require_models
@@ -127,7 +127,7 @@ Any call to I18n that matches a gettext key will be translated through FastGette
127
127
 
128
128
  Namespaces
129
129
  ==========
130
- Car|Model means Model in namespace Car.
130
+ Car|Model means Model in namespace Car.
131
131
  You do not have to translate this into english "Model", if you use the
132
132
  namespace-aware translation
133
133
  s_('Car|Model') == 'Model' #when no translation was found
@@ -199,7 +199,7 @@ lib/tasks/gettext.rake:
199
199
  end
200
200
  end
201
201
 
202
- Contributors
202
+ [Contributors](http://github.com/grosser/gettext_i18n_rails/contributors)
203
203
  ======
204
204
  - [ruby gettext extractor](http://github.com/retoo/ruby_gettext_extractor/tree/master) from [retoo](http://github.com/retoo)
205
205
  - [Paul McMahon](http://github.com/pwim)
@@ -208,6 +208,7 @@ Contributors
208
208
  - [J. Pablo Fernández](http://pupeno.com)
209
209
  - [Anh Hai Trinh](http://blog.onideas.ws)
210
210
  - [ed0h](http://github.com/ed0h)
211
+ - [Nikos Dimitrakopoulos](http://blog.nikosd.com)
211
212
 
212
213
  [Michael Grosser](http://grosser.it)<br/>
213
214
  grosser.michael@gmail.com<br/>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.15
1
+ 0.2.16
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gettext_i18n_rails}
8
- s.version = "0.2.15"
8
+ s.version = "0.2.16"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2011-02-10}
12
+ s.date = %q{2011-02-12}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.files = [
15
15
  "Rakefile",
@@ -16,6 +16,6 @@ class ActiveRecord::Base
16
16
  private
17
17
 
18
18
  def self.gettext_translation_for_attribute_name(attribute)
19
- "#{self}|#{attribute.to_s.gsub('_',' ').capitalize}"
19
+ "#{self}|#{attribute.to_s.split('.').map! {|a| a.gsub('_',' ').capitalize }.join('|')}"
20
20
  end
21
21
  end
@@ -12,10 +12,21 @@ ActiveRecord::Schema.define(:version => 1) do
12
12
  create_table :car_seats, :force=>true do |t|
13
13
  t.string :seat_color
14
14
  end
15
+
16
+ create_table :parts, :force=>true do |t|
17
+ t.string :name
18
+ t.references :car_seat
19
+ end
15
20
  end
16
21
 
17
22
  class CarSeat < ActiveRecord::Base
18
23
  validates_presence_of :seat_color, :message=>"translate me"
24
+ has_many :parts
25
+ accepts_nested_attributes_for :parts
26
+ end
27
+
28
+ class Part < ActiveRecord::Base
29
+ belongs_to :car_seat
19
30
  end
20
31
 
21
32
  describe ActiveRecord::Base do
@@ -35,6 +46,11 @@ describe ActiveRecord::Base do
35
46
  CarSeat.should_receive(:s_).with('CarSeat|Seat color').and_return('Sitz farbe')
36
47
  CarSeat.human_attribute_name(:seat_color).should == 'Sitz farbe'
37
48
  end
49
+
50
+ it "translates nested attributes through FastGettext" do
51
+ CarSeat.should_receive(:s_).with('CarSeat|Parts|Name').and_return('Handle')
52
+ CarSeat.human_attribute_name(:"parts.name").should == 'Handle'
53
+ end
38
54
  end
39
55
 
40
56
  describe 'error messages' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettext_i18n_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 15
10
- version: 0.2.15
9
+ - 16
10
+ version: 0.2.16
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Grosser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-10 00:00:00 +01:00
18
+ date: 2011-02-12 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency