Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ module Document | |
|
||
included do | ||
extend Plugins | ||
extend Translation | ||
end | ||
end # Document | ||
end # MongoMapper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ module EmbeddedDocument | |
|
||
included do | ||
extend Plugins | ||
extend Translation | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
en: | ||
mongo_mapper: | ||
errors: | ||
messages: | ||
taken: "has already been taken" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# encoding: UTF-8 | ||
module MongoMapper | ||
module Translation | ||
include ActiveModel::Translation | ||
|
||
def i18n_scope | ||
:mongo_mapper | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require 'test_helper' | ||
|
||
class TranslationTest < Test::Unit::TestCase | ||
should "translate add mongo_mapper translations" do | ||
I18n.translate("mongo_mapper.errors.messages.taken").should == "has already been taken" | ||
end | ||
|
||
should "set i18n_scope" do | ||
Doc().i18n_scope.should == :mongo_mapper | ||
end | ||
|
||
should "translate document attributes" do | ||
I18n.config.backend.store_translations(:en, :mongo_mapper => {:attributes => {:thing => {:foo => 'Bar'}}}) | ||
doc = Doc('Thing') do | ||
key :foo, String | ||
end | ||
doc.human_attribute_name(:foo).should == 'Bar' | ||
end | ||
|
||
should "translate embedded document attributes" do | ||
I18n.config.backend.store_translations(:en, :mongo_mapper => {:attributes => {:thing => {:foo => 'Bar'}}}) | ||
doc = EDoc('Thing') do | ||
key :foo, String | ||
end | ||
doc.human_attribute_name(:foo).should == 'Bar' | ||
end | ||
end |