<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>unageanu</author_name>
  <author_url>https://blog.hatena.ne.jp/unageanu/</author_url>
  <blog_title>うなの日記</blog_title>
  <blog_url>https://unageanu.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>昨日の続き。Google翻訳APIでは文字列の言語を特定する機能も提供されているので、それを利用して元の言語を自動判定してから翻訳するようにしてみました。これで言語を気にせずにがしがし変換できます。ついでにto_itやto_frなど翻訳可能な言語に対応する変換メソッドもひととおり定義するように修正。 サンプル 翻訳のサンプルは以下。 require 'translate' Translate.set_proxy( &quot;http://proxy.com:80&quot; ) # 必要なら str = &quot;こんにちは こんにちは&quot; # 言語特定 puts str.detect # 翻訳 puts str.to_…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Funageanu.hatenablog.com%2Fentry%2F20090829%2F1251530725&quot; title=&quot; Google翻訳APIで文字列の翻訳と言語の判定を行うモジュール - うなの日記&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2009-08-29 16:25:25</published>
  <title> Google翻訳APIで文字列の翻訳と言語の判定を行うモジュール</title>
  <type>rich</type>
  <url>https://unageanu.hatenablog.com/entry/20090829/1251530725</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
