grosser-fast_gettext 0.4.5 → 0.4.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,16 +43,15 @@ ATM you have to use the [original GetText](http://github.com/mutoh/gettext) to c
43
43
  I already started work on a po/mo parser & reader that is easier to use, contributions welcome @ [pomo](http://github.com/grosser/pomo)
44
44
 
45
45
  ###Database
46
- !!!This is very new/alpha-ish atm and surely will change!!!
47
- Easy to maintain especially with many translations and multiple locales.
48
- An example migration for ActiveRecord can be found in `exaples/db/migration`.
46
+ !!!new/only short time in production, please report back any ideas/suggestions you have!!!
47
+ Easy to maintain especially with many translations and multiple locales.
48
+ [Example migration for ActiveRecord](http://github.com/grosser/fast_gettext/blob/master/examples/db/migration.rb)
49
49
  This is usable with any model DataMapper/Sequel or any other(non-database) backend, the only thing you need to do is respond to the self.translation(key, locale) call.
50
50
  The default plural seperator is `||||` but you may overwrite it (or suggest a better one..).
51
51
  include FastGettext::TranslationRepository::Db.require_models #load and include default models
52
52
  FastGettext.add_text_domain('my_app', :type=>:db, :model=>TranslationKey)
53
- #the model should be the model that represents the keys, you can use FastGettext::TranslationRepository::DbModel::TranslationKey
54
53
 
55
- To get started have a look at the default models in `lib/fast_gettext/translation_repository/db/translation_key`.
54
+ If you want to use your own models, have a look at the [default models](http://github.com/grosser/fast_gettext/tree/master/lib/fast_gettext/translation_repository/db_models) to see what you want/need to implement.
56
55
 
57
56
  Performance
58
57
  ===========
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 4
4
- :patch: 5
4
+ :patch: 7
@@ -2,6 +2,8 @@ module FastGettext::TranslationRepository
2
2
  module DbModels
3
3
  class TranslationKey < ActiveRecord::Base
4
4
  has_many :translations, :class_name=>'TranslationText'
5
+ accepts_nested_attributes_for :translations, :allow_destroy => true
6
+
5
7
  validates_uniqueness_of :key
6
8
  validates_presence_of :key
7
9
 
@@ -2,7 +2,7 @@ module FastGettext::TranslationRepository
2
2
  module DbModels
3
3
  class TranslationText < ActiveRecord::Base
4
4
  belongs_to :key, :class_name=>'TranslationKey'
5
- validates_presence_of :locale, :text
5
+ validates_presence_of :locale
6
6
  validates_uniqueness_of :locale, :scope=>:translation_key_id
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grosser-fast_gettext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-29 00:00:00 -07:00
12
+ date: 2009-05-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15