forked from binarylogic/authlogic
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce i18n translator class that can be replaced by a custom tran…
…slator Signed-off-by: Ben Johnson <bjohnson@binarylogic.com>
- Loading branch information
1 parent
14dc9a7
commit de35f99
Showing
3 changed files
with
56 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Authlogic | ||
module I18n | ||
class Translator | ||
# If the I18n gem is present, calls +I18n.translate+ passing all | ||
# arguments, else returns +options[:default]+. | ||
def translate(key, options = {}) | ||
if defined?(::I18n) | ||
::I18n.translate key, options | ||
else | ||
options[:default] | ||
end | ||
end | ||
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