16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb', line 16
def self.unpack(hLocale, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hLocale.empty?
@MessagePath.issueWarning(510, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intLocale = intMetadataClass.newLocale
if hLocale.has_key?('language')
intLocale[:languageCode] = hLocale['language']
end
if intLocale[:languageCode].nil? || intLocale[:languageCode] == ''
@MessagePath.issueError(511, responseObj, inContext)
end
if hLocale.has_key?('country')
unless hLocale['country'] == ''
intLocale[:countryCode] = hLocale['country']
end
end
if hLocale.has_key?('characterSet')
intLocale[:characterEncoding] = hLocale['characterSet']
end
if intLocale[:characterEncoding].nil? || intLocale[:characterEncoding] == ''
@MessagePath.issueError(512, responseObj, inContext)
end
return intLocale
end
|