GetText.update_pofilesでハマる。解答編
2007 年 10 月 23 日
Comments off
・・・つづき。
- RubyToken::TkIDENTIFIERまたはRubyToken::TkCONSTANTを見つけて
- nameがIDかPLURAL_IDに含まれていれば
- つぎに現れるRubyToken::TkSTRINGのvalueをmsgidとして取り出す
というのがソースからmsgidを抽出する手順だった。
それでは問題の部分はどうなっていたのか、こんなソースをパースしてみた。
def _(word); word.concat('.'); end
here_document_1 = <<EOT
In here_document_1, #{_('one')}
EOT
here_document_2 = <<'EOT'
In here_document_2, #{_('two')}
EOT
implanted_in_string_1 = "In implanted_in_string_1, #{_('three')}"
implanted_in_string_2 = 'In implanted_in_string_2, #{_("four")}'
joined_with_plus = "In joined_with_plus, " + _('five')
just_string = "In just_string, _('six')"
puts here_document_1, here_document_2,
implanted_in_string_1, implanted_in_string_2,
joined_with_plus, just_string
カテゴリー: Ruby