lib/translate_self/translation.rb in translate_self-0.7.0 vs lib/translate_self/translation.rb in translate_self-0.8.0
- old
+ new
@@ -31,20 +31,21 @@
# @return [String] self replaced with the new translation
def translate!
replace translate
end
- # Translates the string itself to a language the user wants to translate it to. \
+ # Translates the string itself to a language the user wants to translate it to.
# Sample usage:
# 'hello'.translate_to_fi
# # Hei
#
# @param [String] the language to translate to, e.g. "fi"
# @return [String] the contents translated to another language
@@languages.each do |lan|
define_method("translate_to_#{lan}") do |language = lan|
call_deepl(self, self.language, language)
end
+ alias_method "t_to_#{lan}", "translate_to_#{lan}"
end
private
def call_deepl(text, language = self.language, to_lan = to_language)