Sha256: 186ed2cb82b3e46fd3de12948535fcb4bfeea39fd8140957a64a56c550d9f3f3

Contents?: true

Size: 633 Bytes

Versions: 9

Compression:

Stored size: 633 Bytes

Contents

<%- 
require 'net/http'
require 'uri'
require 'json'
class GoogleTranslate
  def self.t(text)
    uri = URI.parse('http://ajax.googleapis.com/ajax/services/language/translate')
    JSON.parse(Net::HTTP.post_form(uri, {"q" => text, "langpair" => "en|zh-TW", "v" => '1.0'}).body)['responseData']['translatedText'] rescue text.humanize
  end
end
-%>
"zh-TW":
  activerecord:
    models:
      <%= singular_name %>: <%= GoogleTranslate.t singular_name.humanize %>
    attributes:
      <%= singular_name %>:
<% attributes.each do |attribute| -%>
        <%= attribute.name %>: <%= GoogleTranslate.t attribute.name.humanize %>
<% end -%>

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
somatics3-0.0.10 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml
somatics3-generators-0.0.10 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml
somatics3-generators-0.0.9 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml
somatics3-generators-0.0.8 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml
somatics3-generators-0.0.7 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml
somatics3-generators-0.0.6 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml
somatics3-generators-0.0.5 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml
somatics3-generators-0.0.4 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml
somatics3-generators-0.0.2 lib/generators/somatics/scaffold_controller/templates/locales_zh-TW.yml