live-langset-data/getcountrydata.rb
Dominique Leuenberger 4426928bff Accepting request 526159 from openSUSE:Factory:Live
- Initial package, split from kiwi-config-openSUSE
- Fix target path handling in getcountrydata.rb
- Try to load the distro-specific console data file first

OBS-URL: https://build.opensuse.org/request/show/526159
OBS-URL: https://build.opensuse.org/package/show/system:install:head/live-langset-data?expand=0&rev=1
2017-09-15 09:39:27 +00:00

60 lines
2.0 KiB
Ruby

# encoding: utf-8
module Yast
class GetcountrydataClient < Client
def main
Yast.import "Language"
Yast.import "Keyboard"
Yast.import "Console"
Yast.import "OSRelease"
langs = Language.GetLanguagesMap(true)
consolefonts = SCR.Read(path(".target.yast2"), "consolefonts_#{OSRelease.id}.ycp")
consolefonts ||= SCR.Read(path(".target.yast2"), "consolefonts.ycp")
timezonemap = Language.GetLang2TimezoneMap(true)
dir = ENV["OUTPUTDIR"]
raise "OUTPUTDIR is not set" unless dir
Builtins.foreach(langs) do |lang, ll|
suffix = ll[2] || ""
fqlanguage = lang + suffix
kbd = Keyboard.GetKeyboardForLanguage(lang, "us")
# does not really set keyboard, only fills some data
Keyboard.SetKeyboard(kbd)
# set language for encoding
WFM.SetLanguage(fqlanguage)
yast_kbd = "#{kbd},#{Keyboard.kb_model}"
consolefont = consolefonts[fqlanguage] || consolefonts[lang] || []
font = consolefont[0] || ""
unicodeMap = consolefont[1] || ""
screenMap = consolefont[2] || ""
magic = consolefont[3] || ""
timezone = timezonemap[lang] || ""
contents =
"RC_LANG: #{fqlanguage}\n" +
"CONSOLE_FONT: #{font}\n" +
"CONSOLE_SCREENMAP: #{screenMap}\n" +
"CONSOLE_UNICODEMAP: #{unicodeMap}\n" +
"CONSOLE_MAGIC: #{magic}\n" +
"KEYTABLE: #{Keyboard.keymap}\n" +
"YAST_KEYBOARD: #{yast_kbd}\n" +
"COMPOSETABLE: #{Keyboard.compose_table}\n" +
"TIMEZONE: #{timezone}\n" +
"CONSOLE_ENCODING: #{WFM.GetEncoding}"
contents << "\nRC_LC_MESSAGES: zh_TW.UTF-8" if lang == "zh_HK"
x11data = Keyboard.GetX11KeyData(Keyboard.keymap)
Builtins.foreach(x11data) do |key, val|
contents << "\n#{key}: #{val}"
end
contents << "\n"
SCR.Write(path(".target.string"), dir + "/" + fqlanguage, contents)
end
end
end
end
Yast::GetcountrydataClient.new.main