35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'library/general/src/modules/CustomDialogs.rb', line 35
def load_file_locale(patterns, file_path, language)
patterns = deep_copy(patterns)
i = 0
while Ops.less_than(i, Builtins.size(patterns))
p = Ops.get(patterns, i, "")
tmp = Ops.add(Ops.add(file_path, "/"), p)
if !Builtins.issubstring(p, "%")
Builtins.y2debug("no pattern")
Builtins.y2debug("checking for %1", tmp)
text = Convert.to_string(SCR.Read(path(".target.string"), [tmp, ""]))
break if text != ""
i = Ops.add(i, 1)
next
end
file = Builtins.sformat(tmp, language)
Builtins.y2debug("checking for %1", file)
text = Convert.to_string(SCR.Read(path(".target.string"), [file, ""]))
break if text != ""
file = Builtins.sformat(tmp, Builtins.substring(language, 0, 2))
Builtins.y2debug("checking for %1", file)
text = Convert.to_string(SCR.Read(path(".target.string"), [file, ""]))
break if text != ""
file = Builtins.sformat(tmp, "en")
Builtins.y2debug("checking for %1", file)
text = Convert.to_string(SCR.Read(path(".target.string"), [file, ""]))
break if text != ""
i = Ops.add(i, 1)
end
{ "text" => text, "file" => file }
end
|