Created
January 7, 2009 16:01
-
-
Save hchoroomi/44309 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class String | |
| def translate | |
| I18n.t self, :default => self | |
| end | |
| def t | |
| translate | |
| end | |
| def tn(namespace) | |
| I18n.t self, :scope => namespace, :default => self | |
| end | |
| def /(val) | |
| if sub!('%d', '{{count}}') | |
| I18n.t self, :count => val, :default => self | |
| elsif sub!('%s', '{{s}}') | |
| I18n.t self, :s => val, :default => self | |
| else | |
| translate | |
| end | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment