lib/isodoc/i18n.rb
# TODO: move to localization file
# function localising spaces and punctuation.
# Not clear if period needs to be localised for zh
move to localization file
function localising spaces and punctuation.
Not clear if period needs to be localised for zh
move to localization file function localising spaces and punctuation . Not clear if period needs to be localised for zh
def l10n(text, lang = @lang, script = @script)
      if lang == "zh" && script == "Hans"
        xml = Nokogiri::HTML::DocumentFragment.parse(text)
        xml.traverse do |n|
          next unless n.text?
          n.replace(n.text.gsub(/ /, "").gsub(/:/, "：").gsub(/,/, "、")
            .gsub(/\(/, "（").gsub(/\)/, "）").gsub(/\[/, "【").gsub(/\]/, "】"))
        end
        xml.to_xml.gsub(/<b>/, "").gsub("</b>", "").gsub(/<\?[^>]+>/, "")
      else text
      end
    end
def l10n ( text , lang = @lang , script = @script ) if lang == "zh" && script == "Hans" xml = Nokogiri :: HTML :: DocumentFragment . parse ( text ) xml . traverse do | n | next unless n . text? n . replace ( n . text . gsub ( / / , "" ) . gsub ( / : / , "："). g s ub(/ , / , " ") . gsub ( / \( / , "（"). g s ub(/ \ ) /, " ").gs u b (/\[ / ,  " 【 " .gsub ( / \]/, " 】" ) ) end xml . to_xml . gsub ( / <b> / , "" ) . gsub ( "</b>" , "" ) . gsub ( / < \? [^>]+> / , "" ) else text end end
TODO: move to localization file
function localising spaces and punctuation.
TODO : move to localization file function localising spaces and punctuation .
text
<not_specific>
lang
<not_specific>
script
<not_specific>