Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: fd2e7f0f97
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (37 sloc) 1.006 kB
require 'iron_sharepoint/patches/core/string'
require 'i18n/backend/base'
module I18n
module Backend
module Base
protected
def load_yml(filename)
begin
yaml = YAML::load(File.read filename)
convert_to_utf8 yaml
rescue TypeError
nil
rescue SyntaxError
nil
end
end
def convert_to_utf8 translation
case translation
when String, System::String
bytes = System::Text::Encoding.Default.get_bytes translation
bytes = System::Text::Encoding.convert(System::Text::Encoding.Default, System::Text::Encoding.UTF8, bytes)
(System::Text::Encoding.UTF8.get_string(bytes)).to_s
when Array
translation.map do |x|
convert_to_utf8 x
end
when Hash
converted = {}
translation.each do |k,v|
converted[k] = convert_to_utf8 v
end
converted
end
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.