LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File getcountrydata.ycp of Package kiwi-config-openSUSE (Project openSUSE:Factory:Live)

{
	import "Language";
	import "Keyboard";
	import "Console";

	map<string, list> langs = Language::GetLanguagesMap (true);

	map consolefonts = (map)SCR::Read (.target.yast2, "consolefonts.ycp");
	map timezonemap = Language::GetLang2TimezoneMap(true);

	string dir	= getenv("OUTPUTDIR");

	foreach (string lang, list ll, langs, {

		string suffix	= ll[2]:"";
		string fqlanguage = lang + suffix;

		string kbd	= Keyboard::GetKeyboardForLanguage (lang, "us");

		// does not really set keyboard, only fills some data
		Keyboard::SetKeyboard (kbd);

		// set language for encoding
                WFM::SetLanguage (fqlanguage);

		string yast_kbd	= kbd + "," + Keyboard::kb_model;

		list consolefont=consolefonts[fqlanguage]:consolefonts[lang]:[];
		string font        = consolefont[0]:"";
		string unicodeMap  = consolefont[1]:"";
		string screenMap   = consolefont[2]:"";
		string magic       = consolefont[3]:"";
		string timezone    = timezonemap[lang]:"";

	        string encoding    = WFM::GetEncoding();
		string contents	= sformat ("RC_LANG: %1
CONSOLE_FONT: %2
CONSOLE_SCREENMAP: %3
CONSOLE_UNICODEMAP: %4
CONSOLE_MAGIC: %5
KEYTABLE: %6
YAST_KEYBOARD: %7
COMPOSETABLE: %8
TIMEZONE: %9",
		fqlanguage, font, screenMap, unicodeMap, magic,
		Keyboard::keymap, yast_kbd, Keyboard::compose_table, timezone);

		contents  = contents + sformat("\nCONSOLE_ENCODING: %1", encoding);
		if (lang == "zh_HK")
			contents = contents + "\nRC_LC_MESSAGES: zh_TW.UTF-8";

		map x11data = Keyboard::GetX11KeyData (Keyboard::keymap);
		foreach (string key, string val, (map<string,string>) x11data, {
			contents = sformat ("%1\n%2: %3", contents, key, val);
		});
		contents = contents + "\n";

		SCR::Write (.target.string, dir + fqlanguage, contents);
	});
}