Author: kmachalkova Date: Wed Sep 23 17:22:27 2009 New Revision: 58726 URL: http://svn.opensuse.org/viewcvs/yast?rev=58726&view=rev Log: The same for code 11: - getenv current language (avoid reading uninitialized data from Language::) - getting rid of catch-all regexps (UI supports only html and txt anyway) Modified: branches/SuSE-Code-11-Branch/packager/package/yast2-packager.changes branches/SuSE-Code-11-Branch/packager/src/modules/ProductLicense.ycp Modified: branches/SuSE-Code-11-Branch/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/packager/package/yast2-packager.changes?rev=58726&r1=58725&r2=58726&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/packager/package/yast2-packager.changes (original) +++ branches/SuSE-Code-11-Branch/packager/package/yast2-packager.changes Wed Sep 23 17:22:27 2009 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Wed Sep 23 17:20:23 CEST 2009 - kmachalkova@suse.cz + +- Use getenv to query current language for displaying the license + (instead of uninitialized data from Language:: - bnc#504803, c#28) +- Removed catch-all regexps from license file name patterns - UI + can display only html and txt anyway + +------------------------------------------------------------------- Wed Sep 9 16:47:20 CEST 2009 - kmachalkova@suse.cz - Correct regexp evaluation in searching for suitable file with Modified: branches/SuSE-Code-11-Branch/packager/src/modules/ProductLicense.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/packager/src/modules/ProductLicense.ycp?rev=58726&r1=58725&r2=58726&view=diff ============================================================================== --- branches/SuSE-Code-11-Branch/packager/src/modules/ProductLicense.ycp (original) +++ branches/SuSE-Code-11-Branch/packager/src/modules/ProductLicense.ycp Wed Sep 23 17:22:27 2009 @@ -37,9 +37,20 @@ list <string> license_patterns = [ "license\\.html", "license\\.%1\\.html", "license\\.htm", "license\\.%1\\.htm", - "license\\.txt", "license\\.%1\\.txt", - "license\\.*$", "license\\.%1\\.*$" + "license\\.txt", "license\\.%1\\.txt" ]; +// no more wildcard patterns here, UI can display only html and txt anyway + +// Helper func. Cuts encoding suffix off the LANG +// env. variable i.e. foo_BAR.UTF-8 => foo_BAR +string EnvLangToLangCode ( string env_lang ) +{ + list <string> tmp = []; + if (env_lang != nil) + tmp = splitstring(env_lang, ".@"); + + return tmp[0]:""; +} /** * Creates a unique identification from filename @@ -624,10 +635,16 @@ if (info_file == nil && size (licenses) == 0) return `auto; + // Let's do getenv here. Language::language may not be initialized + // by now (see bnc#504803, c#28). Language::Language does only + // sysconfig reading, which is not too useful in cases like + // 'LANG=foo_BAR yast repositories' + string language = EnvLangToLangCode( getenv("LANG") ); + // Preferencies how the client selects from available languages list<string> langs = [ - Language::language, - substring (Language::language, 0, 2), // "it_IT" -> "it" + language, + substring (language, 0, 2), // "it_IT" -> "it" "en_US", "en_GB", "en", @@ -647,7 +664,7 @@ }); } - y2milestone ("Preffered lang: %1", Language::language); + y2milestone ("Preffered lang: %1", language); if (size (available_langs) == 0) return `auto; // no license available lic_lang = find (string l, langs, { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org