Skip to content

Instantly share code, notes, and snippets.

@hchoroomi
Created January 7, 2009 16:01
Show Gist options
  • Select an option

  • Save hchoroomi/44309 to your computer and use it in GitHub Desktop.

Select an option

Save hchoroomi/44309 to your computer and use it in GitHub Desktop.
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