Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:coolo:alp:hostos:Staging:A
live-langset-data
getcountrydata.rb
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File getcountrydata.rb of Package live-langset-data
# encoding: utf-8 require "json" module Yast class GetcountrydataClient < Client def main Yast.import "Language" Yast.import "Keyboard" Yast.import "Console" Yast.import "OSRelease" langs = Language.GetLanguagesMap(true) consolefonts = nil datafilepath = Directory.find_data_file("consolefonts.json") if datafilepath.nil? consolefonts = SCR.Read(path(".target.yast2"), "consolefonts_#{OSRelease.id}.ycp") consolefonts ||= SCR.Read(path(".target.yast2"), "consolefonts.ycp") else consolefonts = JSON.load(File.read(datafilepath)) end 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 if Keyboard.methods.include? :Codes kbd = Keyboard.GetKeyboardForLanguage(lang, "us") keymap = Keyboard.Codes.key(kbd) else kbd = Keyboard.GetKeyboardForLanguage(lang, "us") # does not really set keyboard, only fills some data Keyboard.SetKeyboard(kbd) keymap = Keyboard.keymap end consolefont = consolefonts[fqlanguage] || consolefonts[lang] if consolefont.nil? && lang.size > 2 consolefont = consolefonts[lang[0,2]] end consolefont ||= [] if consolefont.is_a?(Hash) font = consolefont["font"] || "" unicodeMap = consolefont["unicodeMap"] || "" screenMap = consolefont["screenMap"] || "" magic = consolefont["magic"] || "" else font = consolefont[0] || "" unicodeMap = consolefont[1] || "" screenMap = consolefont[2] || "" magic = consolefont[3] || "" end 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='#{keymap}'\n" + "TIMEZONE='#{timezone}'\n" contents << "RC_LC_MESSAGES='zh_TW.UTF-8'\n" if lang == "zh_HK" SCR.Write(path(".target.string"), dir + "/" + fqlanguage, contents) end end end end Yast::GetcountrydataClient.new.main
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor