[DRE-commits] [ruby-fast-gettext] 01/02: Imported Upstream version 0.8.0

Dmitry Borodaenko angdraug at alioth.debian.org
Sat Sep 7 20:10:10 UTC 2013


This is an automated email from the git hooks/post-receive script.

angdraug pushed a commit to branch master
in repository ruby-fast-gettext.

commit 4f2e651b634c201f26cf2e2f3f5ae36e3753d4cf
Author: Dmitry Borodaenko <angdraug at gmail.com>
Date:   Sat Sep 7 13:09:12 2013 -0700

    Imported Upstream version 0.8.0
---
 .travis.yml                                        |   16 +-
 Appraisals                                         |    7 +-
 Gemfile.lock                                       |   48 ++---
 Readme.md                                          |   26 +++
 gemfiles/rails.2.gemfile.lock                      |   56 ------
 gemfiles/rails.3.gemfile.lock                      |  112 -----------
 gemfiles/{rails.2.gemfile => rails23.gemfile}      |    2 +-
 gemfiles/rails23.gemfile.lock                      |   56 ++++++
 gemfiles/{rails.3.gemfile => rails32.gemfile}      |    2 +-
 gemfiles/rails32.gemfile.lock                      |  112 +++++++++++
 gemfiles/{rails.2.gemfile => rails40.gemfile}      |    3 +-
 gemfiles/rails40.gemfile.lock                      |  110 +++++++++++
 lib/fast_gettext/storage.rb                        |    3 +-
 lib/fast_gettext/translation.rb                    |  100 +++++++++-
 .../db_models/translation_key.rb                   |   10 +-
 .../db_models/translation_text.rb                  |    2 +
 lib/fast_gettext/version.rb                        |    2 +-
 metadata.yml                                       |   67 ++++---
 spec/fast_gettext/storage_spec.rb                  |    7 +-
 .../translation_repository/chain_spec.rb           |    4 +-
 .../fast_gettext/translation_repository/mo_spec.rb |    8 +-
 .../translation_repository/yaml_spec.rb            |    6 +-
 spec/fast_gettext/translation_spec.rb              |  195 +++++++++++++++++++-
 spec/fast_gettext/vendor/string_spec.rb            |   14 +-
 spec/locale/de/LC_MESSAGES/test2.mo                |  Bin 1205 -> 1330 bytes
 spec/locale/de/test.po                             |    3 +
 spec/locale/de/test2.po                            |   53 +++---
 spec/spec_helper.rb                                |   21 +++
 28 files changed, 755 insertions(+), 290 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index e64a944..e04078a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,17 @@
-script: "rake"
+bundler_args: ""
+script: "bundle exec rake spec"
 rvm:
   - ree
-  - 1.9.2
   - 1.9.3
+  - 2.0.0
+gemfile:
+  - gemfiles/rails23.gemfile
+  - gemfiles/rails32.gemfile
+  - gemfiles/rails40.gemfile
+bundler_args: --no-deployment
+matrix:
+  exclude:
+    - rvm: 2.0.0
+      gemfile: gemfiles/rails23.gemfile
+    - rvm: ree
+      gemfile: gemfiles/rails40.gemfile
diff --git a/Appraisals b/Appraisals
index 00018b9..dcb1f25 100644
--- a/Appraisals
+++ b/Appraisals
@@ -1,5 +1,8 @@
-['2', '3'].each do |version|
-  appraise "rails.#{version}" do
+['2.3', '3.2', '4.0'].each do |version|
+  appraise "rails#{version.sub(".", "")}" do
     gem "rails", "~>#{version}.0"
+    if version > "4"
+      gem "protected_attributes"
+    end
   end
 end
diff --git a/Gemfile.lock b/Gemfile.lock
index 74f1174..93ccfd5 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,42 +1,42 @@
 PATH
   remote: .
   specs:
-    fast_gettext (0.7.1)
+    fast_gettext (0.8.0)
 
 GEM
   remote: https://rubygems.org/
   specs:
-    activemodel (3.2.8)
-      activesupport (= 3.2.8)
+    activemodel (3.2.14)
+      activesupport (= 3.2.14)
       builder (~> 3.0.0)
-    activerecord (3.2.8)
-      activemodel (= 3.2.8)
-      activesupport (= 3.2.8)
+    activerecord (3.2.14)
+      activemodel (= 3.2.14)
+      activesupport (= 3.2.14)
       arel (~> 3.0.2)
       tzinfo (~> 0.3.29)
-    activesupport (3.2.8)
-      i18n (~> 0.6)
+    activesupport (3.2.14)
+      i18n (~> 0.6, >= 0.6.4)
       multi_json (~> 1.0)
-    appraisal (0.5.1)
+    appraisal (0.5.2)
       bundler
       rake
     arel (3.0.2)
     builder (3.0.4)
-    bump (0.3.5)
-    diff-lcs (1.1.3)
-    i18n (0.6.1)
-    multi_json (1.3.7)
-    rake (0.9.2.2)
-    rspec (2.11.0)
-      rspec-core (~> 2.11.0)
-      rspec-expectations (~> 2.11.0)
-      rspec-mocks (~> 2.11.0)
-    rspec-core (2.11.1)
-    rspec-expectations (2.11.3)
-      diff-lcs (~> 1.1.3)
-    rspec-mocks (2.11.3)
-    sqlite3 (1.3.6)
-    tzinfo (0.3.35)
+    bump (0.4.2)
+    diff-lcs (1.2.4)
+    i18n (0.6.5)
+    multi_json (1.7.9)
+    rake (10.1.0)
+    rspec (2.14.1)
+      rspec-core (~> 2.14.0)
+      rspec-expectations (~> 2.14.0)
+      rspec-mocks (~> 2.14.0)
+    rspec-core (2.14.5)
+    rspec-expectations (2.14.2)
+      diff-lcs (>= 1.1.3, < 2.0)
+    rspec-mocks (2.14.3)
+    sqlite3 (1.3.8)
+    tzinfo (0.3.37)
 
 PLATFORMS
   ruby
diff --git a/Readme.md b/Readme.md
index c40cb73..a67be5d 100644
--- a/Readme.md
+++ b/Readme.md
@@ -83,6 +83,7 @@ Do this once in every Thread. (e.g. Rails -> ApplicationController)
     _('not-found') == 'not-found'
     s_('Namespace|no-found') == 'not-found'
     n_('Axis','Axis',3) == 'Achsen' #German plural of Axis
+    _('Hello %{name}!') % {:name => "Pete"} == 'Hello Pete!'
 
 
 Managing translations
@@ -196,6 +197,31 @@ Write your own TranslationRepository!
       end
     end
 
+###Multi domain support
+
+If you have more than one gettext domain, there are two sets of functions
+available:
+
+    include FastGettext::TranslationMultidomain
+
+    d_("domainname", "string") # finds 'string' in domain domainname
+    dn_("domainname", "string", "strings", 1) # ditto
+    # etc.
+
+These are helper methods so you don't need to write:
+
+    FastGettext.text_domain = "domainname"
+    _("string")
+
+It is useful in Rails plugins in the views for example. The second set of
+functions are D functions which search for string in _all_ domains. If there
+are multiple translations in different domains, it returns them in random
+order (depends on the Ruby hash implementation):
+
+    include FastGettext::TranslationMultidomain
+
+    D_("string") # finds 'string' in any domain
+    # etc.
 
 FAQ
 ===
diff --git a/gemfiles/rails.2.gemfile.lock b/gemfiles/rails.2.gemfile.lock
deleted file mode 100644
index 2c6be0c..0000000
--- a/gemfiles/rails.2.gemfile.lock
+++ /dev/null
@@ -1,56 +0,0 @@
-PATH
-  remote: /Users/mgrosser/code/tools/fast_gettext
-  specs:
-    fast_gettext (0.7.0)
-
-GEM
-  remote: https://rubygems.org/
-  specs:
-    actionmailer (2.3.14)
-      actionpack (= 2.3.14)
-    actionpack (2.3.14)
-      activesupport (= 2.3.14)
-      rack (~> 1.1.0)
-    activerecord (2.3.14)
-      activesupport (= 2.3.14)
-    activeresource (2.3.14)
-      activesupport (= 2.3.14)
-    activesupport (2.3.14)
-    appraisal (0.5.1)
-      bundler
-      rake
-    bump (0.3.5)
-    diff-lcs (1.1.3)
-    i18n (0.6.1)
-    rack (1.1.3)
-    rails (2.3.14)
-      actionmailer (= 2.3.14)
-      actionpack (= 2.3.14)
-      activerecord (= 2.3.14)
-      activeresource (= 2.3.14)
-      activesupport (= 2.3.14)
-      rake (>= 0.8.3)
-    rake (0.9.2.2)
-    rspec (2.11.0)
-      rspec-core (~> 2.11.0)
-      rspec-expectations (~> 2.11.0)
-      rspec-mocks (~> 2.11.0)
-    rspec-core (2.11.1)
-    rspec-expectations (2.11.3)
-      diff-lcs (~> 1.1.3)
-    rspec-mocks (2.11.3)
-    sqlite3 (1.3.6)
-
-PLATFORMS
-  ruby
-
-DEPENDENCIES
-  activerecord
-  appraisal
-  bump
-  fast_gettext!
-  i18n
-  rails (~> 2.0)
-  rake
-  rspec
-  sqlite3
diff --git a/gemfiles/rails.3.gemfile.lock b/gemfiles/rails.3.gemfile.lock
deleted file mode 100644
index c950024..0000000
--- a/gemfiles/rails.3.gemfile.lock
+++ /dev/null
@@ -1,112 +0,0 @@
-PATH
-  remote: /Users/mgrosser/code/tools/fast_gettext
-  specs:
-    fast_gettext (0.7.0)
-
-GEM
-  remote: https://rubygems.org/
-  specs:
-    actionmailer (3.2.8)
-      actionpack (= 3.2.8)
-      mail (~> 2.4.4)
-    actionpack (3.2.8)
-      activemodel (= 3.2.8)
-      activesupport (= 3.2.8)
-      builder (~> 3.0.0)
-      erubis (~> 2.7.0)
-      journey (~> 1.0.4)
-      rack (~> 1.4.0)
-      rack-cache (~> 1.2)
-      rack-test (~> 0.6.1)
-      sprockets (~> 2.1.3)
-    activemodel (3.2.8)
-      activesupport (= 3.2.8)
-      builder (~> 3.0.0)
-    activerecord (3.2.8)
-      activemodel (= 3.2.8)
-      activesupport (= 3.2.8)
-      arel (~> 3.0.2)
-      tzinfo (~> 0.3.29)
-    activeresource (3.2.8)
-      activemodel (= 3.2.8)
-      activesupport (= 3.2.8)
-    activesupport (3.2.8)
-      i18n (~> 0.6)
-      multi_json (~> 1.0)
-    appraisal (0.5.1)
-      bundler
-      rake
-    arel (3.0.2)
-    builder (3.0.4)
-    bump (0.3.5)
-    diff-lcs (1.1.3)
-    erubis (2.7.0)
-    hike (1.2.1)
-    i18n (0.6.1)
-    journey (1.0.4)
-    json (1.7.5)
-    mail (2.4.4)
-      i18n (>= 0.4.0)
-      mime-types (~> 1.16)
-      treetop (~> 1.4.8)
-    mime-types (1.19)
-    multi_json (1.3.7)
-    polyglot (0.3.3)
-    rack (1.4.1)
-    rack-cache (1.2)
-      rack (>= 0.4)
-    rack-ssl (1.3.2)
-      rack
-    rack-test (0.6.2)
-      rack (>= 1.0)
-    rails (3.2.8)
-      actionmailer (= 3.2.8)
-      actionpack (= 3.2.8)
-      activerecord (= 3.2.8)
-      activeresource (= 3.2.8)
-      activesupport (= 3.2.8)
-      bundler (~> 1.0)
-      railties (= 3.2.8)
-    railties (3.2.8)
-      actionpack (= 3.2.8)
-      activesupport (= 3.2.8)
-      rack-ssl (~> 1.3.2)
-      rake (>= 0.8.7)
-      rdoc (~> 3.4)
-      thor (>= 0.14.6, < 2.0)
-    rake (0.9.2.2)
-    rdoc (3.12)
-      json (~> 1.4)
-    rspec (2.11.0)
-      rspec-core (~> 2.11.0)
-      rspec-expectations (~> 2.11.0)
-      rspec-mocks (~> 2.11.0)
-    rspec-core (2.11.1)
-    rspec-expectations (2.11.3)
-      diff-lcs (~> 1.1.3)
-    rspec-mocks (2.11.3)
-    sprockets (2.1.3)
-      hike (~> 1.2)
-      rack (~> 1.0)
-      tilt (~> 1.1, != 1.3.0)
-    sqlite3 (1.3.6)
-    thor (0.16.0)
-    tilt (1.3.3)
-    treetop (1.4.12)
-      polyglot
-      polyglot (>= 0.3.1)
-    tzinfo (0.3.35)
-
-PLATFORMS
-  ruby
-
-DEPENDENCIES
-  activerecord
-  appraisal
-  bump
-  fast_gettext!
-  i18n
-  rails (~> 3.0)
-  rake
-  rspec
-  sqlite3
diff --git a/gemfiles/rails.2.gemfile b/gemfiles/rails23.gemfile
similarity index 79%
copy from gemfiles/rails.2.gemfile
copy to gemfiles/rails23.gemfile
index ca1d327..48e0ee0 100644
--- a/gemfiles/rails.2.gemfile
+++ b/gemfiles/rails23.gemfile
@@ -9,6 +9,6 @@ gem "rspec"
 gem "activerecord"
 gem "i18n"
 gem "bump"
-gem "rails", "~>2.0"
+gem "rails", "~>2.3.0"
 
 gemspec :path=>"../"
\ No newline at end of file
diff --git a/gemfiles/rails23.gemfile.lock b/gemfiles/rails23.gemfile.lock
new file mode 100644
index 0000000..df17155
--- /dev/null
+++ b/gemfiles/rails23.gemfile.lock
@@ -0,0 +1,56 @@
+PATH
+  remote: /Users/mgrosser/code/tools/fast_gettext
+  specs:
+    fast_gettext (0.7.1)
+
+GEM
+  remote: https://rubygems.org/
+  specs:
+    actionmailer (2.3.18)
+      actionpack (= 2.3.18)
+    actionpack (2.3.18)
+      activesupport (= 2.3.18)
+      rack (~> 1.1.0)
+    activerecord (2.3.18)
+      activesupport (= 2.3.18)
+    activeresource (2.3.18)
+      activesupport (= 2.3.18)
+    activesupport (2.3.18)
+    appraisal (0.5.2)
+      bundler
+      rake
+    bump (0.4.2)
+    diff-lcs (1.2.4)
+    i18n (0.6.4)
+    rack (1.1.6)
+    rails (2.3.18)
+      actionmailer (= 2.3.18)
+      actionpack (= 2.3.18)
+      activerecord (= 2.3.18)
+      activeresource (= 2.3.18)
+      activesupport (= 2.3.18)
+      rake (>= 0.8.3)
+    rake (10.1.0)
+    rspec (2.14.1)
+      rspec-core (~> 2.14.0)
+      rspec-expectations (~> 2.14.0)
+      rspec-mocks (~> 2.14.0)
+    rspec-core (2.14.4)
+    rspec-expectations (2.14.0)
+      diff-lcs (>= 1.1.3, < 2.0)
+    rspec-mocks (2.14.2)
+    sqlite3 (1.3.7)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  activerecord
+  appraisal
+  bump
+  fast_gettext!
+  i18n
+  rails (~> 2.3.0)
+  rake
+  rspec
+  sqlite3
diff --git a/gemfiles/rails.3.gemfile b/gemfiles/rails32.gemfile
similarity index 79%
rename from gemfiles/rails.3.gemfile
rename to gemfiles/rails32.gemfile
index 2bbdb6c..b13b7a0 100644
--- a/gemfiles/rails.3.gemfile
+++ b/gemfiles/rails32.gemfile
@@ -9,6 +9,6 @@ gem "rspec"
 gem "activerecord"
 gem "i18n"
 gem "bump"
-gem "rails", "~>3.0"
+gem "rails", "~>3.2.0"
 
 gemspec :path=>"../"
\ No newline at end of file
diff --git a/gemfiles/rails32.gemfile.lock b/gemfiles/rails32.gemfile.lock
new file mode 100644
index 0000000..b19cf26
--- /dev/null
+++ b/gemfiles/rails32.gemfile.lock
@@ -0,0 +1,112 @@
+PATH
+  remote: /Users/mgrosser/code/tools/fast_gettext
+  specs:
+    fast_gettext (0.7.1)
+
+GEM
+  remote: https://rubygems.org/
+  specs:
+    actionmailer (3.2.14)
+      actionpack (= 3.2.14)
+      mail (~> 2.5.4)
+    actionpack (3.2.14)
+      activemodel (= 3.2.14)
+      activesupport (= 3.2.14)
+      builder (~> 3.0.0)
+      erubis (~> 2.7.0)
+      journey (~> 1.0.4)
+      rack (~> 1.4.5)
+      rack-cache (~> 1.2)
+      rack-test (~> 0.6.1)
+      sprockets (~> 2.2.1)
+    activemodel (3.2.14)
+      activesupport (= 3.2.14)
+      builder (~> 3.0.0)
+    activerecord (3.2.14)
+      activemodel (= 3.2.14)
+      activesupport (= 3.2.14)
+      arel (~> 3.0.2)
+      tzinfo (~> 0.3.29)
+    activeresource (3.2.14)
+      activemodel (= 3.2.14)
+      activesupport (= 3.2.14)
+    activesupport (3.2.14)
+      i18n (~> 0.6, >= 0.6.4)
+      multi_json (~> 1.0)
+    appraisal (0.5.2)
+      bundler
+      rake
+    arel (3.0.2)
+    builder (3.0.4)
+    bump (0.4.2)
+    diff-lcs (1.2.4)
+    erubis (2.7.0)
+    hike (1.2.3)
+    i18n (0.6.4)
+    journey (1.0.4)
+    json (1.8.0)
+    mail (2.5.4)
+      mime-types (~> 1.16)
+      treetop (~> 1.4.8)
+    mime-types (1.23)
+    multi_json (1.7.8)
+    polyglot (0.3.3)
+    rack (1.4.5)
+    rack-cache (1.2)
+      rack (>= 0.4)
+    rack-ssl (1.3.3)
+      rack
+    rack-test (0.6.2)
+      rack (>= 1.0)
+    rails (3.2.14)
+      actionmailer (= 3.2.14)
+      actionpack (= 3.2.14)
+      activerecord (= 3.2.14)
+      activeresource (= 3.2.14)
+      activesupport (= 3.2.14)
+      bundler (~> 1.0)
+      railties (= 3.2.14)
+    railties (3.2.14)
+      actionpack (= 3.2.14)
+      activesupport (= 3.2.14)
+      rack-ssl (~> 1.3.2)
+      rake (>= 0.8.7)
+      rdoc (~> 3.4)
+      thor (>= 0.14.6, < 2.0)
+    rake (10.1.0)
+    rdoc (3.12.2)
+      json (~> 1.4)
+    rspec (2.14.1)
+      rspec-core (~> 2.14.0)
+      rspec-expectations (~> 2.14.0)
+      rspec-mocks (~> 2.14.0)
+    rspec-core (2.14.4)
+    rspec-expectations (2.14.0)
+      diff-lcs (>= 1.1.3, < 2.0)
+    rspec-mocks (2.14.2)
+    sprockets (2.2.2)
+      hike (~> 1.2)
+      multi_json (~> 1.0)
+      rack (~> 1.0)
+      tilt (~> 1.1, != 1.3.0)
+    sqlite3 (1.3.7)
+    thor (0.18.1)
+    tilt (1.4.1)
+    treetop (1.4.14)
+      polyglot
+      polyglot (>= 0.3.1)
+    tzinfo (0.3.37)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  activerecord
+  appraisal
+  bump
+  fast_gettext!
+  i18n
+  rails (~> 3.2.0)
+  rake
+  rspec
+  sqlite3
diff --git a/gemfiles/rails.2.gemfile b/gemfiles/rails40.gemfile
similarity index 70%
rename from gemfiles/rails.2.gemfile
rename to gemfiles/rails40.gemfile
index ca1d327..10f0252 100644
--- a/gemfiles/rails.2.gemfile
+++ b/gemfiles/rails40.gemfile
@@ -9,6 +9,7 @@ gem "rspec"
 gem "activerecord"
 gem "i18n"
 gem "bump"
-gem "rails", "~>2.0"
+gem "rails", "~>4.0.0"
+gem "protected_attributes"
 
 gemspec :path=>"../"
\ No newline at end of file
diff --git a/gemfiles/rails40.gemfile.lock b/gemfiles/rails40.gemfile.lock
new file mode 100644
index 0000000..56e1b3a
--- /dev/null
+++ b/gemfiles/rails40.gemfile.lock
@@ -0,0 +1,110 @@
+PATH
+  remote: /Users/mgrosser/code/tools/fast_gettext
+  specs:
+    fast_gettext (0.7.1)
+
+GEM
+  remote: https://rubygems.org/
+  specs:
+    actionmailer (4.0.0)
+      actionpack (= 4.0.0)
+      mail (~> 2.5.3)
+    actionpack (4.0.0)
+      activesupport (= 4.0.0)
+      builder (~> 3.1.0)
+      erubis (~> 2.7.0)
+      rack (~> 1.5.2)
+      rack-test (~> 0.6.2)
+    activemodel (4.0.0)
+      activesupport (= 4.0.0)
+      builder (~> 3.1.0)
+    activerecord (4.0.0)
+      activemodel (= 4.0.0)
+      activerecord-deprecated_finders (~> 1.0.2)
+      activesupport (= 4.0.0)
+      arel (~> 4.0.0)
+    activerecord-deprecated_finders (1.0.3)
+    activesupport (4.0.0)
+      i18n (~> 0.6, >= 0.6.4)
+      minitest (~> 4.2)
+      multi_json (~> 1.3)
+      thread_safe (~> 0.1)
+      tzinfo (~> 0.3.37)
+    appraisal (0.5.2)
+      bundler
+      rake
+    arel (4.0.0)
+    atomic (1.1.13)
+    builder (3.1.4)
+    bump (0.4.2)
+    diff-lcs (1.2.4)
+    erubis (2.7.0)
+    hike (1.2.3)
+    i18n (0.6.5)
+    mail (2.5.4)
+      mime-types (~> 1.16)
+      treetop (~> 1.4.8)
+    mime-types (1.24)
+    minitest (4.7.5)
+    multi_json (1.7.9)
+    polyglot (0.3.3)
+    protected_attributes (1.0.3)
+      activemodel (>= 4.0.0, < 5.0)
+    rack (1.5.2)
+    rack-test (0.6.2)
+      rack (>= 1.0)
+    rails (4.0.0)
+      actionmailer (= 4.0.0)
+      actionpack (= 4.0.0)
+      activerecord (= 4.0.0)
+      activesupport (= 4.0.0)
+      bundler (>= 1.3.0, < 2.0)
+      railties (= 4.0.0)
+      sprockets-rails (~> 2.0.0)
+    railties (4.0.0)
+      actionpack (= 4.0.0)
+      activesupport (= 4.0.0)
+      rake (>= 0.8.7)
+      thor (>= 0.18.1, < 2.0)
+    rake (10.1.0)
+    rspec (2.14.1)
+      rspec-core (~> 2.14.0)
+      rspec-expectations (~> 2.14.0)
+      rspec-mocks (~> 2.14.0)
+    rspec-core (2.14.5)
+    rspec-expectations (2.14.2)
+      diff-lcs (>= 1.1.3, < 2.0)
+    rspec-mocks (2.14.3)
+    sprockets (2.10.0)
+      hike (~> 1.2)
+      multi_json (~> 1.0)
+      rack (~> 1.0)
+      tilt (~> 1.1, != 1.3.0)
+    sprockets-rails (2.0.0)
+      actionpack (>= 3.0)
+      activesupport (>= 3.0)
+      sprockets (~> 2.8)
+    sqlite3 (1.3.8)
+    thor (0.18.1)
+    thread_safe (0.1.2)
+      atomic
+    tilt (1.4.1)
+    treetop (1.4.15)
+      polyglot
+      polyglot (>= 0.3.1)
+    tzinfo (0.3.37)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  activerecord
+  appraisal
+  bump
+  fast_gettext!
+  i18n
+  protected_attributes
+  rails (~> 4.0.0)
+  rake
+  rspec
+  sqlite3
diff --git a/lib/fast_gettext/storage.rb b/lib/fast_gettext/storage.rb
index 8e90639..ba577f2 100644
--- a/lib/fast_gettext/storage.rb
+++ b/lib/fast_gettext/storage.rb
@@ -13,8 +13,7 @@ module FastGettext
     [:available_locales, :_locale, :text_domain, :pluralisation_rule].each do |method_name|
       key = "fast_gettext_#{method_name}".to_sym
       define_method "#{method_name}=" do |value|
-        Thread.current[key]=value
-        update_current_cache
+        update_current_cache if Thread.current[key] != Thread.current[key]=value
       end
     end
 
diff --git a/lib/fast_gettext/translation.rb b/lib/fast_gettext/translation.rb
index 82897e7..4a019ad 100644
--- a/lib/fast_gettext/translation.rb
+++ b/lib/fast_gettext/translation.rb
@@ -17,15 +17,15 @@ module FastGettext
       klas.extend self
     end
 
-    def _(key)
-      FastGettext.cached_find(key) or key
+    def _(key, &block)
+      FastGettext.cached_find(key) or (block ? block.call : key)
     end
 
     #translate pluralized
     # some languages have up to 4 plural forms...
     # n_(singular, plural, plural form 2, ..., count)
     # n_('apple','apples',3)
-    def n_(*keys)
+    def n_(*keys, &block)
       count = keys.pop
       translations = FastGettext.cached_plural_find(*keys)
 
@@ -38,15 +38,15 @@ module FastGettext
       elsif keys[selected]
         _(keys[selected])
       else
-        keys.last
+        block ? block.call : keys.last
       end
     end
 
     #translate, but discard namespace if nothing was found
     # Car|Tire -> Tire if no translation could be found
-    def s_(key,separator=nil)
+    def s_(key, separator=nil, &block)
       translation = FastGettext.cached_find(key) and return translation
-      key.split(separator||NAMESPACE_SEPARATOR).last
+      block ? block.call : key.split(separator||NAMESPACE_SEPARATOR).last
     end
 
     #tell gettext: this string need translation (will be found during parsing)
@@ -59,8 +59,92 @@ module FastGettext
       keys
     end
 
-    def ns_(*args)
-      n_(*args).split(NAMESPACE_SEPARATOR).last
+    def ns_(*args, &block)
+      translation = n_(*args, &block)
+      # block is called once again to compare result
+      block && translation == block.call ? translation : translation.split(NAMESPACE_SEPARATOR).last
+    end
+  end
+
+  # this module should be included for multi-domain support
+  module TranslationMultidomain
+    extend self
+
+    #make it usable in class definition, e.g.
+    # class Y
+    #   include FastGettext::TranslationMultidomain
+    #   @@x = d_('domain', 'y')
+    # end
+    def self.included(klas)  #:nodoc:
+      klas.extend self
+    end
+
+    # helper block for changing domains
+    def _in_domain domain
+      old_domain = FastGettext.text_domain
+      FastGettext.text_domain = domain
+      yield if block_given?
+    ensure
+      FastGettext.text_domain = old_domain
+    end
+
+    # gettext functions to translate in the context of given domain
+    def d_(domain, key, &block)
+      _in_domain domain do
+        FastGettext::Translation._(key, &block)
+      end
+    end
+
+    def dn_(domain, *keys, &block)
+      _in_domain domain do
+        FastGettext::Translation.n_(*keys, &block)
+      end
+    end
+
+    def ds_(domain, key, separator=nil, &block)
+      _in_domain domain do
+        FastGettext::Translation.s_(key, separator, &block)
+      end
+    end
+
+    def dns_(domain, *keys, &block)
+      _in_domain domain do
+        FastGettext::Translation.ns_(*keys, &block)
+      end
+    end
+
+    # gettext functions to translate in the context of any domain
+    # (note: if mutiple domains contains key, random translation is returned)
+    def D_(key)
+      FastGettext.translation_repositories.each_key do |domain|
+        result = FastGettext::TranslationMultidomain.d_(domain, key) {nil}
+        return result unless result.nil?
+      end
+      key
+    end
+
+    def Dn_(*keys)
+      FastGettext.translation_repositories.each_key do |domain|
+        result = FastGettext::TranslationMultidomain.dn_(domain, *keys) {nil}
+        return result unless result.nil?
+      end
+      keys[-3].split(keys[-2]||NAMESPACE_SEPARATOR).last
+    end
+
+    def Ds_(key, separator=nil)
+      FastGettext.translation_repositories.each_key do |domain|
+        result = FastGettext::TranslationMultidomain.ds_(domain, key, separator) {nil}
+        return result unless result.nil?
+      end
+      key.split(separator||NAMESPACE_SEPARATOR).last
+    end
+
+    def Dns_(*keys)
+      FastGettext.translation_repositories.each_key do |domain|
+        result = FastGettext::TranslationMultidomain.dns_(domain, *keys) {nil}
+        return result unless result.nil?
+      end
+      keys[-2].split(NAMESPACE_SEPARATOR).last
     end
   end
 end
diff --git a/lib/fast_gettext/translation_repository/db_models/translation_key.rb b/lib/fast_gettext/translation_repository/db_models/translation_key.rb
index 4e7f222..af0295c 100644
--- a/lib/fast_gettext/translation_repository/db_models/translation_key.rb
+++ b/lib/fast_gettext/translation_repository/db_models/translation_key.rb
@@ -1,3 +1,5 @@
+require "protected_attributes" if ActiveRecord::VERSION::MAJOR >= 4
+
 class TranslationKey < ActiveRecord::Base
   has_many :translations, :class_name => 'TranslationText', :dependent => :destroy
 
@@ -17,7 +19,13 @@ class TranslationKey < ActiveRecord::Base
   end
 
   def self.available_locales
-    @@available_locales ||= TranslationText.count(:group=>:locale).keys.sort
+    @@available_locales ||= begin
+      if ActiveRecord::VERSION::MAJOR >= 3
+        TranslationText.group(:locale).count
+      else
+        TranslationText.count(:group=>:locale)
+      end.keys.sort
+    end
   end
 
   protected
diff --git a/lib/fast_gettext/translation_repository/db_models/translation_text.rb b/lib/fast_gettext/translation_repository/db_models/translation_text.rb
index 3132ecf..5b842e6 100644
--- a/lib/fast_gettext/translation_repository/db_models/translation_text.rb
+++ b/lib/fast_gettext/translation_repository/db_models/translation_text.rb
@@ -1,3 +1,5 @@
+require "protected_attributes" if ActiveRecord::VERSION::MAJOR >= 4
+
 class TranslationText < ActiveRecord::Base
   belongs_to :translation_key, :class_name => 'TranslationKey'
   validates_presence_of :locale
diff --git a/lib/fast_gettext/version.rb b/lib/fast_gettext/version.rb
index 4c16aab..081e848 100644
--- a/lib/fast_gettext/version.rb
+++ b/lib/fast_gettext/version.rb
@@ -1,3 +1,3 @@
 module FastGettext
-  VERSION = Version = '0.7.1'
+  VERSION = Version = '0.8.0'
 end
diff --git a/metadata.yml b/metadata.yml
index a7767a3..6800c11 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,22 +1,32 @@
---- !ruby/object:Gem::Specification
+--- !ruby/object:Gem::Specification 
 name: fast_gettext
-version: !ruby/object:Gem::Version
-  version: 0.7.1
+version: !ruby/object:Gem::Version 
+  hash: 63
   prerelease: 
+  segments: 
+  - 0
+  - 8
+  - 0
+  version: 0.8.0
 platform: ruby
-authors:
+authors: 
 - Michael Grosser
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2013-06-19 00:00:00.000000000 Z
+
+date: 2013-08-30 00:00:00 Z
 dependencies: []
+
 description: 
 email: michael at grosser.it
 executables: []
+
 extensions: []
+
 extra_rdoc_files: []
-files:
+
+files: 
 - .gitignore
 - .travis.yml
 - Appraisals
@@ -39,10 +49,12 @@ files:
 - examples/db/migration.rb
 - examples/missing_translation_logger.rb
 - fast_gettext.gemspec
-- gemfiles/rails.2.gemfile
-- gemfiles/rails.2.gemfile.lock
-- gemfiles/rails.3.gemfile
-- gemfiles/rails.3.gemfile.lock
+- gemfiles/rails23.gemfile
+- gemfiles/rails23.gemfile.lock
+- gemfiles/rails32.gemfile
+- gemfiles/rails32.gemfile.lock
+- gemfiles/rails40.gemfile
+- gemfiles/rails40.gemfile.lock
 - lib/fast_gettext.rb
 - lib/fast_gettext/mo_file.rb
 - lib/fast_gettext/po_file.rb
@@ -105,35 +117,38 @@ files:
 - spec/spec_helper.rb
 - spec/support/be_accessible_matcher.rb
 homepage: http://github.com/grosser/fast_gettext
-licenses:
+licenses: 
 - MIT
 - Ruby
 post_install_message: 
 rdoc_options: []
-require_paths:
+
+require_paths: 
 - lib
-required_ruby_version: !ruby/object:Gem::Requirement
+required_ruby_version: !ruby/object:Gem::Requirement 
   none: false
-  requirements:
-  - - ! '>='
-    - !ruby/object:Gem::Version
-      version: '0'
-      segments:
+  requirements: 
+  - - ">="
+    - !ruby/object:Gem::Version 
+      hash: 3
+      segments: 
       - 0
-      hash: 278086574654590991
-required_rubygems_version: !ruby/object:Gem::Requirement
+      version: "0"
+required_rubygems_version: !ruby/object:Gem::Requirement 
   none: false
-  requirements:
-  - - ! '>='
-    - !ruby/object:Gem::Version
-      version: '0'
-      segments:
+  requirements: 
+  - - ">="
+    - !ruby/object:Gem::Version 
+      hash: 3
+      segments: 
       - 0
-      hash: 278086574654590991
+      version: "0"
 requirements: []
+
 rubyforge_project: 
 rubygems_version: 1.8.25
 signing_key: 
 specification_version: 3
 summary: A simple, fast, memory-efficient and threadsafe implementation of GetText
 test_files: []
+
diff --git a/spec/fast_gettext/storage_spec.rb b/spec/fast_gettext/storage_spec.rb
index e6a97c7..9c4b153 100644
--- a/spec/fast_gettext/storage_spec.rb
+++ b/spec/fast_gettext/storage_spec.rb
@@ -61,7 +61,7 @@ describe 'Storage' do
 
   describe :pluralisation_rule do
     it "defaults to singular-if-1 when it is not set" do
-      stub!(:current_repository).and_return mock('',:pluralisation_rule=>nil)
+      should_receive(:current_repository).at_least(1).and_return double(:pluralisation_rule => nil)
       self.pluralisation_rule = nil
       pluralisation_rule.call(1).should == false
       pluralisation_rule.call(0).should == true
@@ -256,8 +256,8 @@ describe 'Storage' do
       FastGettext.text_domain = 'xxx'
       FastGettext.available_locales = ['de','en']
       FastGettext.locale = 'de'
-      FastGettext.current_repository.stub!(:"[]").with('abc').and_return 'old'
-      FastGettext.current_repository.stub!(:"[]").with('unfound').and_return nil
+      FastGettext.current_repository.stub(:"[]").with('abc').and_return 'old'
+      FastGettext.current_repository.stub(:"[]").with('unfound').and_return nil
       FastGettext._('abc')
       FastGettext._('unfound')
       FastGettext.locale = 'en'
@@ -333,7 +333,6 @@ describe 'Storage' do
 
     it "does not overwrite an existing cache value" do
       current_cache['xxx']='xxx'
-      stub!(:current_repository).and_return 'xxx'=>'1'
       key_exist?('xxx')
       current_cache['xxx'].should == 'xxx'
     end
diff --git a/spec/fast_gettext/translation_repository/chain_spec.rb b/spec/fast_gettext/translation_repository/chain_spec.rb
index e7c5b56..e80bb3c 100644
--- a/spec/fast_gettext/translation_repository/chain_spec.rb
+++ b/spec/fast_gettext/translation_repository/chain_spec.rb
@@ -36,9 +36,9 @@ describe 'FastGettext::TranslationRepository::Chain' do
   describe "filled chain" do
     before do
       @one = MockRepo.new
-      @one.stub!(:singular).with('xx').and_return 'one'
+      @one.stub(:singular).with('xx').and_return 'one'
       @two = MockRepo.new
-      @two.stub!(:singular).with('xx').and_return 'two'
+      @two.stub(:singular).with('xx').and_return 'two'
       @rep = FastGettext::TranslationRepository.build('chain', :chain=>[@one, @two], :type=>:chain)
     end
 
diff --git a/spec/fast_gettext/translation_repository/mo_spec.rb b/spec/fast_gettext/translation_repository/mo_spec.rb
index e4048f1..5913fee 100644
--- a/spec/fast_gettext/translation_repository/mo_spec.rb
+++ b/spec/fast_gettext/translation_repository/mo_spec.rb
@@ -31,11 +31,11 @@ describe 'FastGettext::TranslationRepository::Mo' do
     it "can reload" do
       FastGettext.locale = 'de'
 
-      @rep['Untranslated'].should be_nil
+      @rep['Untranslated and translated in test2'].should be_nil
 
       @rep.reload
 
-      @rep['Untranslated'].should == 'Translated'
+      @rep['Untranslated and translated in test2'].should == 'Translated'
     end
 
     it "returns true" do
@@ -51,6 +51,8 @@ describe 'FastGettext::TranslationRepository::Mo' do
   end
 
   it "can work in SAFE mode" do
-    `ruby spec/cases/safe_mode_can_handle_locales.rb 2>&1`.should == 'true'
+    pending_if RUBY_VERSION > "2.0" do
+      `ruby spec/cases/safe_mode_can_handle_locales.rb 2>&1`.should == 'true'
+    end
   end
 end
diff --git a/spec/fast_gettext/translation_repository/yaml_spec.rb b/spec/fast_gettext/translation_repository/yaml_spec.rb
index 69c3c8c..1800178 100644
--- a/spec/fast_gettext/translation_repository/yaml_spec.rb
+++ b/spec/fast_gettext/translation_repository/yaml_spec.rb
@@ -61,7 +61,7 @@ describe 'FastGettext::TranslationRepository::Yaml' do
   end
 
   it "can be used to translate plural forms" do
-    FastGettext.stub!(:current_repository).and_return @rep
+    FastGettext.stub(:current_repository).and_return @rep
     FastGettext.n_('cars.axis','cars.axis',2).should == 'Achsen'
     FastGettext.n_('cars.axis',2).should == 'Achsen'
     FastGettext.n_('cars.axis',1).should == 'Achse'
@@ -69,8 +69,8 @@ describe 'FastGettext::TranslationRepository::Yaml' do
 
   4.times do |i|
     it "can be used to do wanky pluralisation rules #{i}" do
-      FastGettext.stub!(:current_repository).and_return @rep
-      @rep.stub!(:pluralisation_rule).and_return lambda{|x| i}
+      FastGettext.stub(:current_repository).and_return @rep
+      @rep.stub(:pluralisation_rule).and_return lambda{|x| i}
       FastGettext.n_('cars.silly',1).should == i.to_s # cars.silly translations are 0,1,2,3
     end
   end
diff --git a/spec/fast_gettext/translation_spec.rb b/spec/fast_gettext/translation_spec.rb
index 323cf09..4cc70cf 100644
--- a/spec/fast_gettext/translation_spec.rb
+++ b/spec/fast_gettext/translation_spec.rb
@@ -2,6 +2,7 @@ require "spec_helper"
 
 describe FastGettext::Translation do
   include FastGettext::Translation
+  include FastGettext::TranslationMultidomain
 
   before do
     default_setup
@@ -42,6 +43,14 @@ describe FastGettext::Translation do
     it "does not return the gettext meta information" do
       _('').should == ''
     end
+
+    it "returns nil when specified" do
+      _('not found'){nil}.should be_nil
+    end
+
+    it "returns block when specified" do
+      _('not found'){:block}.should == :block
+    end
   end
 
   describe :n_ do
@@ -85,6 +94,10 @@ describe FastGettext::Translation do
       FastGettext.pluralisation_rule = lambda{|x|4}
       n_('Apple','Apples',2).should == 'Apples'
     end
+
+    it "returns block when specified" do
+      n_('not found'){:block}.should == :block
+    end
   end
 
   describe :s_ do
@@ -99,6 +112,10 @@ describe FastGettext::Translation do
     it "can use a custom seperator" do
       s_("XXX/not found",'/').should == "not found"
     end
+
+    it "returns block when specified" do
+      s_('not found'){:block}.should == :block
+    end
   end
 
   describe :N_ do
@@ -117,13 +134,181 @@ describe FastGettext::Translation do
     it "translates whith namespace" do
       ns_('Fruit|Apple','Fruit|Apples',2).should == 'Apples'
     end
+
+    it "returns block when specified" do
+      ns_('not found'){:block}.should == :block
+      ns_('not found'){nil}.should be_nil
+    end
   end
 
+  describe :multi_domain do
+    before do
+      setup_extra_domain
+    end
+
+    describe :_in_domain do
+      it "changes domain via in_domain" do
+        Thread.current[:fast_gettext_text_domain].should == "test"
+        _in_domain "fake" do
+          Thread.current[:fast_gettext_text_domain].should == "fake"
+        end
+        Thread.current[:fast_gettext_text_domain].should == "test"
+      end
+    end
+
+    describe :d_ do
+      it "translates simple text" do
+        d_('test', 'car').should == 'Auto'
+      end
+
+      it "translates simple text in different domain" do
+        d_('test2', 'car').should == 'Auto 2'
+      end
+
+      it "translates simple text in different domain one transaction" do
+        d_('test', 'car').should == 'Auto'
+        d_('test2', 'car').should == 'Auto 2'
+      end
+
+      it "returns the original string if its translation is blank" do
+        d_('test', 'Untranslated').should == 'Untranslated'
+      end
+
+      it "sets text domain back to previous one" do
+        old_domain = FastGettext.text_domain
+        d_('test2', 'car').should == 'Auto 2'
+        FastGettext.text_domain.should == old_domain
+      end
+
+      it "returns appropriate key if translation is not found in a domain" do
+        FastGettext.translation_repositories['fake'] = {}
+        d_('fake', 'car').should == 'car'
+      end
+    end
+
+    describe :dn_ do
+      before do
+        FastGettext.pluralisation_rule = nil
+      end
+
+      it "translates pluralized" do
+        dn_('test', 'Axis','Axis',1).should == 'Achse'
+        dn_('test2', 'Axis','Axis',1).should == 'Achse 2'
+      end
+
+      it "returns a simple translation when no combined was found" do
+        dn_('test', 'Axis','NOTFOUNDs',1).should == 'Achse'
+        dn_('test2', 'Axis','NOTFOUNDs',1).should == 'Achse 2'
+      end
+
+      it "returns the appropriate key if no translation was found" do
+        dn_('test', 'NOTFOUND','NOTFOUNDs',1).should == 'NOTFOUND'
+        dn_('test', 'NOTFOUND','NOTFOUNDs',2).should == 'NOTFOUNDs'
+      end
+
+      it "returns the last key when no translation was found and keys where to short" do
+        FastGettext.pluralisation_rule = lambda{|x|4}
+        dn_('test', 'Apple','Apples',2).should == 'Apples'
+      end
+    end
+
+    describe :ds_ do
+      it "translates simple text" do
+        ds_('test2', 'car').should == 'Auto 2'
+        ds_('test', 'car').should == 'Auto'
+      end
+
+      it "returns cleaned key if a translation was not found" do
+        ds_('test2', "XXX|not found").should == "not found"
+      end
+
+      it "can use a custom seperator" do
+        ds_('test2', "XXX/not found",'/').should == "not found"
+      end
+    end
+
+    describe :dns_ do
+      it "translates whith namespace" do
+        dns_('test', 'Fruit|Apple','Fruit|Apples',2).should == 'Apples'
+        dns_('test2', 'Fruit|Apple','Fruit|Apples',2).should == 'Apples'
+      end
+    end
+  end
+
+  describe :multidomain_all do
+    before do
+      setup_extra_domain
+    end
+
+    describe :D_ do
+      it "translates simple text" do
+        D_('not found').should == 'not found'
+        D_('only in test2 domain').should == 'nur in test2 Domain'
+      end
+
+      it "returns translation from random domain" do
+        D_('car').should match('(Auto|Auto 2)')
+      end
+
+      it "sets text domain back to previous one" do
+        old_domain = FastGettext.text_domain
+        D_('car').should == 'Auto'
+        FastGettext.text_domain.should == old_domain
+      end
+    end
+
+    describe :Dn_ do
+      before do
+        FastGettext.pluralisation_rule = nil
+      end
+
+      it "translates pluralized" do
+        Dn_('Axis','Axis',1).should match('(Achse|Achse 2)')
+      end
+
+      it "returns a simple translation when no combined was found" do
+        Dn_('Axis','NOTFOUNDs',1).should match('(Achse|Achse 2)')
+      end
+
+      it "returns the appropriate key if no translation was found" do
+        Dn_('NOTFOUND','NOTFOUNDs',1).should == 'NOTFOUND'
+      end
+
+      it "returns the last key when no translation was found and keys where to short" do
+        Dn_('Apple','Apples',2).should == 'Apples'
+      end
+    end
+
+    describe :Ds_ do
+      it "translates simple text" do
+        Ds_('car').should match('(Auto|Auto 2)')
+      end
+
+      it "returns cleaned key if a translation was not found" do
+        Ds_("XXX|not found").should == "not found"
+      end
+
+      it "can use a custom seperator" do
+        Ds_("XXX/not found",'/').should == "not found"
+      end
+    end
+
+    describe :Dns_ do
+      it "translates whith namespace" do
+        Dns_('Fruit|Apple','Fruit|Apples',1).should == 'Apple'
+        Dns_('Fruit|Apple','Fruit|Apples',2).should == 'Apples'
+      end
+
+      it "returns cleaned key if a translation was not found" do
+        Dns_("XXX|not found", "YYY|not found", 1).should == "not found"
+        Dns_("XXX|not found", "YYY|not found", 2).should == "not found"
+      end
+    end
+  end
 
   describe :caching do
     describe :cache_hit do
       before do
-        FastGettext.translation_repositories.replace({})
         #singular cache keys
         FastGettext.current_cache['xxx'] = '1'
 
@@ -166,5 +351,13 @@ describe FastGettext::Translation do
       FastGettext.text_domain = 'test'
       _('car').should == 'Auto'
     end
+
+    it "caches different textdomains seperatly for d_" do
+      _('car').should == 'Auto'
+
+      FastGettext.translation_repositories['fake'] = {}
+      d_('fake', 'car').should == 'car'
+      d_('test','car').should == 'Auto'
+    end
   end
 end
diff --git a/spec/fast_gettext/vendor/string_spec.rb b/spec/fast_gettext/vendor/string_spec.rb
index 4ee3b9d..d767ad0 100644
--- a/spec/fast_gettext/vendor/string_spec.rb
+++ b/spec/fast_gettext/vendor/string_spec.rb
@@ -1,14 +1,6 @@
 require "spec_helper"
 
 describe String do
-  def pending_18
-    if RUBY_VERSION > '1.9'
-      yield
-    else
-      pending "does not work on 1.8"
-    end
-  end
-
   before :all do
     if "i18n gem overwrites % method".respond_to?(:interpolate_without_ruby_19_syntax)
       class String
@@ -92,14 +84,16 @@ describe String do
   end
 
   describe 'with i18n loaded' do
+    let(:pending_condition) { (RUBY_VERSION < "1.9" and ActiveRecord::VERSION::MAJOR == 3) or ActiveRecord::VERSION::MAJOR >= 4 }
+
     it "interpolates if i18n is loaded before" do
-      pending_18 do
+      pending_if pending_condition, "does not work on ree + rails 3 or rails 4"  do
         system("bundle exec ruby spec/cases/interpolate_i18n_before_fast_gettext.rb  > /dev/null 2>&1").should == true
       end
     end
 
     it "interpolates if i18n is loaded before" do
-      pending_18 do
+      pending_if pending_condition, "does not work on ree + rails 3 or rails 4"  do
         system("bundle exec ruby spec/cases/interpolate_i18n_after_fast_gettext.rb > /dev/null 2>&1").should == true
       end
     end
diff --git a/spec/locale/de/LC_MESSAGES/test2.mo b/spec/locale/de/LC_MESSAGES/test2.mo
index d27b453..fbf006a 100644
Binary files a/spec/locale/de/LC_MESSAGES/test2.mo and b/spec/locale/de/LC_MESSAGES/test2.mo differ
diff --git a/spec/locale/de/test.po b/spec/locale/de/test.po
index 51968d8..6cbb1f5 100644
--- a/spec/locale/de/test.po
+++ b/spec/locale/de/test.po
@@ -41,6 +41,9 @@ msgstr "Modell"
 msgid "Untranslated"
 msgstr ""
 
+msgid "Untranslated and translated in test2"
+msgstr ""
+
 #: app/views/cars/show.html.erb:3 locale/model_attributes.rb:4
 msgid "Car|Wheels count"
 msgstr "Räderzahl"
diff --git a/spec/locale/de/test2.po b/spec/locale/de/test2.po
index 27f5588..a7691f4 100644
--- a/spec/locale/de/test2.po
+++ b/spec/locale/de/test2.po
@@ -1,8 +1,6 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
-#
+# this is the same file as test.po but with "2" added to each translation
+# and one extra translation added
+
 #, fuzzy
 msgid ""
 msgstr ""
@@ -16,56 +14,51 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
 
-#: app/helpers/translation_helper.rb:3
 msgid "%{relative_time} ago"
-msgstr "vor %{relative_time}"
+msgstr "vor %{relative_time} 2"
 
-#: app/views/cars/show.html.erb:5
 msgid "Axis"
-msgid_plural "Axis"
-msgstr[0] "Achse"
-msgstr[1] "Achsen"
+msgid_plural "Axis 2"
+msgstr[0] "Achse 2"
+msgstr[1] "Achsen 2"
 
-#: app/controllers/cars_controller.rb:47
 msgid "Car was successfully created."
-msgstr "Auto wurde erfolgreich gespeichert"
+msgstr "Auto wurde erfolgreich gespeichert 2"
 
-#: app/controllers/cars_controller.rb:64
 msgid "Car was successfully updated."
-msgstr "Auto wurde erfolgreich aktualisiert"
+msgstr "Auto wurde erfolgreich aktualisiert 2"
 
-#: app/views/cars/show.html.erb:1 locale/model_attributes.rb:3
 msgid "Car|Model"
-msgstr "Modell"
+msgstr "Modell 2"
 
 msgid "Untranslated"
+msgstr ""
+
+msgid "Untranslated and translated in test2"
 msgstr "Translated"
 
-#: app/views/cars/show.html.erb:3 locale/model_attributes.rb:4
 msgid "Car|Wheels count"
-msgstr "Räderzahl"
+msgstr "Räderzahl 2"
 
-#: app/views/cars/show.html.erb:7
 msgid "Created"
-msgstr "Erstellt"
+msgstr "Erstellt 2"
 
-#: app/views/cars/show.html.erb:9
 msgid "Month"
-msgstr "Monat"
+msgstr "Monat 2"
 
-#: locale/model_attributes.rb:2
 msgid "car"
-msgstr "Auto"
+msgstr "Auto 2"
 
-#: locale/testlog_phrases.rb:2
 msgid "this is a dynamic translation which was found thorugh gettext_test_log!"
 msgstr ""
 "Dies ist eine dynamische Übersetzung, die durch gettext_test_log "
-"gefunden wurde!"
+"gefunden wurde! 2"
 
-#: locale/test_escape.rb:2
 msgid "You should escape '\\' as '\\\\'."
-msgstr "Du solltest '\\' als '\\\\' escapen."
+msgstr "Du solltest '\\' als '\\\\' escapen. 2"
 
 msgid "Umläüte"
-msgstr "Umlaute"
+msgstr "Umlaute 2"
+
+msgid "only in test2 domain"
+msgstr "nur in test2 Domain"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 1d9f746..f4428f7 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -14,8 +14,29 @@ RSpec.configure do |config|
 end
 
 def default_setup
+  # make sure all tests are really independent
+  Thread.current[:fast_gettext_text_domain] = nil
+  Thread.current[:fast_gettext__locale] = nil
+  Thread.current[:fast_gettext_available_locales] = nil
+  Thread.current[:fast_gettext_pluralisation_rule] = nil
+  Thread.current[:fast_gettext_current_cache] = nil
+  FastGettext.send(:class_variable_set, :@@translation_repositories, {})
+  FastGettext.send(:class_variable_set, :@@caches, {})
   FastGettext.add_text_domain('test',:path=>File.join(File.dirname(__FILE__),'locale'))
   FastGettext.text_domain = 'test'
   FastGettext.available_locales = ['en','de','gsw_CH']
   FastGettext.locale = 'de'
+  FastGettext.send(:update_current_cache)
+end
+
+def pending_if(condition, *args)
+  if condition
+    pending(*args) { yield }
+  else
+    yield
+  end
+end
+
+def setup_extra_domain
+  FastGettext.add_text_domain('test2',:path=>File.join(File.dirname(__FILE__),'locale'))
 end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-fast-gettext.git



More information about the Pkg-ruby-extras-commits mailing list