Hello community, here is the log from the commit of package yast2-country for openSUSE:Factory checked in at 2016-08-18 10:18:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-country (Old) and /work/SRC/openSUSE:Factory/.yast2-country.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-country" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-country/yast2-country.changes 2016-06-11 00:00:12.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-country.new/yast2-country.changes 2016-08-18 10:18:42.000000000 +0200 @@ -1,0 +2,22 @@ +Wed Aug 10 14:27:49 CEST 2016 - [email protected] + +- Added check for correct <language /> coming from an AutoYast + profile. When erroneous language is detected, then it's reported + and corrected to the default 'en_US' (bnc#991001). +- 3.1.29 + +------------------------------------------------------------------- +Mon Jul 25 14:55:00 UTC 2016 - [email protected] + +- Added support for Asturian variant of Spanish keyboard + (bsc#981008) +- Asturian variant is now the default layout for Asturian language +- 3.1.28 + +------------------------------------------------------------------- +Mon Jun 20 11:55:00 UTC 2016 - [email protected] + +- Use the eurlatg font for all languages with latin alphabet + and simplify language<->font mapping (bsc#942899, bsc#942896). + +------------------------------------------------------------------- Old: ---- yast2-country-3.1.27.tar.bz2 New: ---- yast2-country-3.1.29.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-country.spec ++++++ --- /var/tmp/diff_new_pack.akh4kD/_old 2016-08-18 10:18:43.000000000 +0200 +++ /var/tmp/diff_new_pack.akh4kD/_new 2016-08-18 10:18:43.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-country -Version: 3.1.27 +Version: 3.1.29 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-country-3.1.27.tar.bz2 -> yast2-country-3.1.29.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/console/src/data/consolefonts.ycp new/yast2-country-3.1.29/console/src/data/consolefonts.ycp --- old/yast2-country-3.1.27/console/src/data/consolefonts.ycp 2016-06-07 14:02:46.000000000 +0200 +++ new/yast2-country-3.1.29/console/src/data/consolefonts.ycp 2016-08-10 16:53:54.000000000 +0200 @@ -6,93 +6,39 @@ $[ // LANG font unicode map screen map, console magic - "en_GB@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "en_GB" : [ "lat1-16.psfu", "", "none", "(B" ], - "en_US" : [ "lat1-16.psfu", "", "none", "(B" ], - "en" : [ "lat1-16.psfu", "", "none", "(B" ], - "en_US.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "en_GB.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "de_DE@euro" : [ "lat9w-16.psfu", "", "trivial", "(B" ], - "de_DE" : [ "lat1-16.psfu", "", "none", "(B" ], - "de_CH" : [ "lat1-16.psfu", "", "none", "(B" ], - "de" : [ "lat1-16.psfu", "", "none", "(B" ], - "de_DE.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "de_CH.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "de_AT.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "fr_FR@euro" : [ "lat9w-16.psfu", "", "trivial", "(B" ], - "fr_FR" : [ "lat1-16.psfu", "", "none", "(B" ], - "fr_CH" : [ "lat1-16.psfu", "", "none", "(B" ], - "fr" : [ "lat1-16.psfu", "", "none", "(B" ], - "fr_FR.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "it_IT@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "it_IT" : [ "lat1-16.psfu", "", "none", "(B" ], - "it" : [ "lat1-16.psfu", "", "none", "(B" ], - "it_IT.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "es_ES@euro" : [ "lat9w-16.psfu", "", "trivial", "(B" ], - "es_ES" : [ "lat1-16.psfu", "", "none", "(B" ], - "es" : [ "lat1-16.psfu", "", "none", "(B" ], - "es_ES.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "nl_NL@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "nl_NL" : [ "lat1-16.psfu", "", "none", "(B" ], - "nl" : [ "lat1-16.psfu", "", "none", "(B" ], - "nl_NL.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "pt_PT@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "pt_PT" : [ "lat1-16.psfu", "", "none", "(B" ], - "pt_BR" : [ "lat1-16.psfu", "", "trivial", "(B" ], - "pt" : [ "lat1-16.psfu", "", "none", "(B" ], - "pt_PT.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "pt_BR.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "ca_ES@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "ca_ES" : [ "lat1-16.psfu", "", "none", "(B" ], - "ca" : [ "lat1-16.psfu", "", "none", "(B" ], - "ca_ES.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "gl_ES@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "gl_ES" : [ "lat1-16.psfu", "", "none", "(B" ], - "gl" : [ "lat1-16.psfu", "", "none", "(B" ], - "gl_ES.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - - "br_FR@euro" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "br_FR" : [ "lat1-16.psfu", "", "none", "(B" ], - "br" : [ "lat1-16.psfu", "", "none", "(B" ], - "br_FR.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], + "en" : [ "eurlatgr.psfu", "", "none", "" ], +// The two-letters language is used as a fallback, so additional entries like +// the ones displayed below are not needed as long as they use the same values. +// "en_GB@euro" : [ "eurlatgr.psfu", "", "none", "" ], +// "en_GB" : [ "eurlatgr.psfu", "", "none", "" ], +// "en_US" : [ "eurlatgr.psfu", "", "none", "" ], +// "en_US.UTF-8" : [ "eurlatgr.psfu", "", "none", "" ], +// "en_GB.UTF-8" : [ "eurlatgr.psfu", "", "none", "" ], + "de" : [ "eurlatgr.psfu", "", "none", "" ], + "fr" : [ "eurlatgr.psfu", "", "none", "" ], + "it" : [ "eurlatgr.psfu", "", "none", "" ], + "es" : [ "eurlatgr.psfu", "", "none", "" ], + "nl" : [ "eurlatgr.psfu", "", "none", "" ], + "pt" : [ "eurlatgr.psfu", "", "none", "" ], + "ca" : [ "eurlatgr.psfu", "", "none", "" ], + "gl" : [ "eurlatgr.psfu", "", "none", "" ], + "br" : [ "eurlatgr.psfu", "", "none", "" ], + "pl" : [ "eurlatgr.psfu", "", "none", "" ], + "cs" : [ "eurlatgr.psfu", "", "none", "" ], + "sk" : [ "eurlatgr.psfu", "", "none", "" ], + "hu" : [ "eurlatgr.psfu", "", "none", "" ], + "lt" : [ "eurlatgr.psfu", "", "none", "" ], + "ja" : [ "eurlatgr.psfu", "", "none", "" ], "el_GR" : [ "iso07u-16.psfu", "", "trivial", "(K" ], "el" : [ "iso07u-16.psfu", "", "trivial", "(K" ], "el_GR.UTF-8" : [ "iso07u-16.psfu", "", "trivial", "(K" ], - "pl_PL" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - "pl" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - "pl_PL.UTF-8" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - - "cs_CZ" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - "cs" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - "cs_CZ.UTF-8" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - - "sk_SK" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - "sk" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - "sk_SK.UTF-8" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - - "hu_HU" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - "hu" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - "hu_HU.UTF-8" : [ "lat2-16.psfu", "", "8859-2", "(K" ], - - "lt_LT" : [ "lat4a-16.psfu", "", "8859-13", "(K" ], - "lt" : [ "lat4a-16.psfu", "", "8859-13", "(K" ], - "lt_LT.UTF-8" : [ "lat4a-16.psfu", "", "8859-13", "(K" ], - "ru_RU.KOI8-R" : [ "UniCyr_8x16.psf", "", "koi2alt", "(K" ], "ru" : [ "UniCyr_8x16.psf", "", "koi2alt", "(K" ], "ru_RU.UTF-8" : [ "UniCyr_8x16.psf", "", "none", "(K" ], - "sr_RS@latin" : [ "lat2-16.psfu", "", "8859-2", "(K" ], + "sr_RS@latin" : [ "eurlatgr.psfu", "", "trivial", "" ], "sr" : [ "UniCyr_8x16.psf", "", "trivial", "(K" ], "sr_RS.UTF-8" : [ "UniCyr_8x16.psf", "", "none", "(K" ], @@ -106,10 +52,6 @@ "bg" : [ "UniCyr_8x16.psf", "", "trivial", "(K" ], "bg_BG.UTF-8" : [ "UniCyr_8x16.psf", "", "none", "(K" ], - "ja_JP.sjis" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "ja" : [ "lat1-16.psfu", "", "none", "(K" ], - "ja_JP.UTF-8" : [ "lat9w-16.psfu", "", "trivial", "(K" ], - "tr_TR" : [ "iso09.f16n", "", "none", "(K" ], "tr" : [ "iso09.f16n", "", "none", "(K" ], "tr_TR.UTF-8" : [ "iso09.f16n", "", "trivial", "(K" ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/console/src/modules/Console.rb new/yast2-country-3.1.29/console/src/modules/Console.rb --- old/yast2-country-3.1.27/console/src/modules/Console.rb 2016-06-07 14:02:46.000000000 +0200 +++ new/yast2-country-3.1.29/console/src/modules/Console.rb 2016-08-10 16:53:54.000000000 +0200 @@ -80,35 +80,24 @@ # @return [String] encoding encoding for console i/o def SelectFont(lang) - consolefont = [] - consolefonts = Convert.to_map( WFM.Read(path(".local.yast2"), "consolefonts.ycp") ) - fqlanguage = Language.GetLocaleString(lang) - consolefont = Ops.get_list(consolefonts, fqlanguage, []) - - if Builtins.size(consolefont) == 0 - consolefont = Ops.get_list(consolefonts, lang, []) - end - if Builtins.size(consolefont) == 0 && - Ops.greater_than(Builtins.size(lang), 2) - consolefont = Ops.get_list( - consolefonts, - Builtins.substring(lang, 0, 2), - [] - ) + consolefont = consolefonts[fqlanguage] || consolefonts[lang] + if consolefont.nil? && lang.size > 2 + consolefont = consolefonts[lang[0,2]] end + consolefont ||= [] - if Ops.greater_than(Builtins.size(consolefont), 0) + if !consolefont.empty? @language = lang - @font = Ops.get_string(consolefont, 0, "") - @unicodeMap = Ops.get_string(consolefont, 1, "") - @screenMap = Ops.get_string(consolefont, 2, "") - @magic = Ops.get_string(consolefont, 3, "") + @font = consolefont[0] || "" + @unicodeMap = consolefont[1] || "" + @screenMap = consolefont[2] || "" + @magic = consolefont[3] || "" currentLanguage = WFM.GetLanguage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/keyboard/src/data/keyboard_raw.ycp new/yast2-country-3.1.29/keyboard/src/data/keyboard_raw.ycp --- old/yast2-country-3.1.27/keyboard/src/data/keyboard_raw.ycp 2016-06-07 14:02:46.000000000 +0200 +++ new/yast2-country-3.1.29/keyboard/src/data/keyboard_raw.ycp 2016-08-10 16:53:54.000000000 +0200 @@ -175,6 +175,18 @@ "type5_euro": $[ "ncurses": "es-sundeadkeys.map.gz" ], ] ], + "spanish-ast": + [ + // keyboard layout + _("Spanish (Asturian variant)"), + $[ + "pc104" : $[ "ncurses": "es-ast.map.gz"], + "macintosh" : $[ "ncurses": "es-mac.map.gz"], + "type4" : $[ "ncurses": "es-sundeadkeys.map.gz"], + "type5" : $[ "ncurses": "es-sundeadkeys.map.gz" ], + "type5_euro": $[ "ncurses": "es-sundeadkeys.map.gz" ], + ] + ], "italian": [ // keyboard layout diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/language/Makefile.am new/yast2-country-3.1.29/language/Makefile.am --- old/yast2-country-3.1.27/language/Makefile.am 2016-06-07 14:02:47.000000000 +0200 +++ new/yast2-country-3.1.29/language/Makefile.am 2016-08-10 16:53:54.000000000 +0200 @@ -1,4 +1,4 @@ # # Makefile.am for country/language -SUBDIRS = src testsuite +SUBDIRS = src testsuite test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/language/src/data/languages/language_ast_ES.ycp new/yast2-country-3.1.29/language/src/data/languages/language_ast_ES.ycp --- old/yast2-country-3.1.27/language/src/data/languages/language_ast_ES.ycp 2016-06-07 14:02:47.000000000 +0200 +++ new/yast2-country-3.1.29/language/src/data/languages/language_ast_ES.ycp 2016-08-10 16:53:54.000000000 +0200 @@ -38,6 +38,6 @@ // 2. what time zone propose for this language "timezone" : "Europe/Madrid", // 3. which keyboard layout propose for this language - "keyboard" : "spanish", + "keyboard" : "spanish-ast", ]; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/language/src/modules/Language.rb new/yast2-country-3.1.29/language/src/modules/Language.rb --- old/yast2-country-3.1.27/language/src/modules/Language.rb 2016-06-07 14:02:47.000000000 +0200 +++ new/yast2-country-3.1.29/language/src/modules/Language.rb 2016-08-10 16:53:54.000000000 +0200 @@ -31,6 +31,10 @@ module Yast class LanguageClass < Module + DEFAULT_FALLBACK_LANGUAGE = "en_US".freeze + + include Yast::Logger + def main Yast.import "Pkg" Yast.import "UI" @@ -49,15 +53,19 @@ Yast.import "PackageSystem" Yast.import "Popup" Yast.import "ProductFeatures" + Yast.import "Report" Yast.import "SlideShow" Yast.import "Stage" + # directory where all the language definitions are stored + # it's a constant, but depends on a dynamic content (Directory) + @languages_directory = "#{Directory.datadir}/languages" # currently selected language - @language = "en_US" + @language = DEFAULT_FALLBACK_LANGUAGE # original language - @language_on_entry = "en_US" + @language_on_entry = DEFAULT_FALLBACK_LANGUAGE # language preselected in /etc/install.inf @preselected = "en_US" @@ -68,13 +76,12 @@ @linuxrc_language_set = false # Default language to be restored with MakeProposal. - @default_language = "en_US" + @default_language = DEFAULT_FALLBACK_LANGUAGE # Default settings for ROOT_USES_LANG in /etc/sysconfig/language @rootlang = "ctype" - # Default settings for INSTALLED_LANGUAGES in /etc/sysconfig/language @languages = "" @@ -108,10 +115,8 @@ # mapping of language to its default (proposed) kbd layout @lang2keyboard = {} - # directory with languages descriptions - @languages_directory = nil - # languages that cannot be correctly shown in text mode + # if the system (Linuxrc) does not start with them from the beginning @cjk_languages = [ "ja", "ko", @@ -163,9 +168,6 @@ # Read language DB: translatable strings will be translated to current language def read_languages_map - if @languages_directory == nil - @languages_directory = Ops.add(Directory.datadir, "/languages") - end Builtins.foreach( Convert.convert( SCR.Read(path(".target.dir"), @languages_directory, []), @@ -204,7 +206,7 @@ Ops.set( @lang2keyboard, code, - Ops.get_string(language_map, "keyboard", "en_US") + Ops.get_string(language_map, "keyboard", DEFAULT_FALLBACK_LANGUAGE) ) end end @@ -219,9 +221,6 @@ def ReadLanguageMap(lang) ret = {} - if @languages_directory == nil - @languages_directory = Ops.add(Directory.datadir, "/languages") - end file = Builtins.sformat("language_%1.ycp", lang) if FileUtils.Exists(Ops.add(Ops.add(@languages_directory, "/"), file)) ret = Convert.to_map( @@ -363,70 +362,128 @@ filename end + # Downloads inst-sys extension for a given language + # including giving a UI feedback to the user + # + # @param [String] language, e.g. 'de_DE' + def integrate_inst_sys_extension(language) + log.info "integrating translation extension..." + + # busy message + Popup.ShowFeedback( + "", + _("Downloading installation system language extension...") + ) + + InstExtensionImage.DownloadAndIntegrateExtension( + GetLanguageExtensionFilename(language) + ) + + Popup.ClearFeedback + log.info "integrating translation extension... done" + end + + # Returns whether the given language string is supported by this library. + # + # @param [String] language + # @see @languages_directory + def valid_language?(language) + GetLanguagesMap(false).key?(language) + end + + # Checks whether given language is supported by the installer + # and changes it to the default language en_US if it isn't. + # + # @param [String] reference to the new language + # @return [String] new (corrected) language + def correct_language(language) + # No correction needed, this is already a correct language definition + return language if valid_language?(language) + + # TRANSLATORS: Error message. Strings marked %{...} will be replaced + # with variable content - do not translate them, please. + Report.Error( + _("Language '%{language}' was not found within the list of supported languages\n" + + "available at %{directory}.\n\nFallback language %{fallback} will be used." + ) % { + :language => language, + :directory => @languages_directory, + :fallback => DEFAULT_FALLBACK_LANGUAGE + } + ) + + return DEFAULT_FALLBACK_LANGUAGE + end + + # Changes the install.inf in inst-sys according to newly selected language + # + # FIXME: code just moved, refactoring needed + def adapt_install_inf + yinf = {} + yinf_ref = arg_ref(yinf) + AsciiFile.SetDelimiter(yinf_ref, " ") + yinf = yinf_ref.value + yinf_ref = arg_ref(yinf) + AsciiFile.ReadFile(yinf_ref, "/etc/yast.inf") + yinf = yinf_ref.value + lines = AsciiFile.FindLineField(yinf, 0, "Language:") + + if Ops.greater_than(Builtins.size(lines), 0) + yinf_ref = arg_ref(yinf) + AsciiFile.ChangeLineField( + yinf_ref, + Ops.get_integer(lines, 0, -1), + 1, + @language + ) + yinf = yinf_ref.value + else + yinf_ref = arg_ref(yinf) + AsciiFile.AppendLine(yinf_ref, ["Language:", @language]) + yinf = yinf_ref.value + end + + yinf_ref = arg_ref(yinf) + AsciiFile.RewriteFile(yinf_ref, "/etc/yast.inf") + yinf = yinf_ref.value + end # Set module to selected language. + # # @param [String] lang language string ISO code of language def Set(lang) + lang = deep_copy(lang) + Builtins.y2milestone( "original language: %1; setting to lang:%2", @language, lang ) - if @language != lang # Do it only if different + if @language != lang + lang = correct_language(lang) + if Stage.initial && !Mode.test && !Mode.live_installation - Builtins.y2milestone("integrating translation extension...") - # busy message - Popup.ShowFeedback( - "", - _("Downloading installation system language extension...") - ) - InstExtensionImage.DownloadAndIntegrateExtension( - GetLanguageExtensionFilename(lang) - ) - Popup.ClearFeedback - Builtins.y2milestone("integrating translation extension... done") + integrate_inst_sys_extension(@language) end - read_languages_map if Builtins.size(@languages_map) == 0 GetLocales() if Builtins.size(@locales) == 0 - @name = Ops.get_string(@languages_map, [lang, 0], lang) - @name = Ops.get_string(@languages_map, [lang, 4], lang) if Mode.config + language_def = GetLanguagesMap(false).fetch(lang, []) + # In config mode, use language name translated into the current language + # othewrwise use the language name translated into that selected language + # because the whole UI will get translated later too + @name = (Mode.config ? language_def[4] : language_def[0]) || lang @language = lang Encoding.SetEncLang(@language) end if Stage.initial && !Mode.test - yinf = {} - yinf_ref = arg_ref(yinf) - AsciiFile.SetDelimiter(yinf_ref, " ") - yinf = yinf_ref.value - yinf_ref = arg_ref(yinf) - AsciiFile.ReadFile(yinf_ref, "/etc/yast.inf") - yinf = yinf_ref.value - lines = AsciiFile.FindLineField(yinf, 0, "Language:") - if Ops.greater_than(Builtins.size(lines), 0) - yinf_ref = arg_ref(yinf) - AsciiFile.ChangeLineField( - yinf_ref, - Ops.get_integer(lines, 0, -1), - 1, - @language - ) - yinf = yinf_ref.value - else - yinf_ref = arg_ref(yinf) - AsciiFile.AppendLine(yinf_ref, ["Language:", @language]) - yinf = yinf_ref.value - end - yinf_ref = arg_ref(yinf) - AsciiFile.RewriteFile(yinf_ref, "/etc/yast.inf") - yinf = yinf_ref.value + adapt_install_inf # update "name" for proposal when it cannot be shown correctly if GetTextMode() && CJKLanguage(lang) && !CJKLanguage(@preselected) - @name = Ops.get_string(@languages_map, [lang, 1], lang) + @name = GetLanguagesMap(false).fetch(lang, [])[1] || lang end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/language/test/Language_test.rb new/yast2-country-3.1.29/language/test/Language_test.rb --- old/yast2-country-3.1.27/language/test/Language_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-country-3.1.29/language/test/Language_test.rb 2016-08-10 16:53:54.000000000 +0200 @@ -0,0 +1,146 @@ +#!/usr/bin/env rspec + +require_relative "test_helper" + +Yast.import "Language" + +describe "Language" do + subject { Yast::Language } + + let(:languages_map) {{ + "de_DE" => [ + "Deutsch", + "Deutsch", + ".UTF-8", + "@euro", + "German" + ], + "pt_BR" => [ + "Português brasileiro", + "Portugues brasileiro", + ".UTF-8", + "", + "Portuguese (Brazilian)" + ], + # This is a "CJK" language + "ja_JP" => [ + "日本語", + "Japanese", + ".UTF-8", + ".eucJP", + "Japanese" + ] + }} + + before do + allow(subject).to receive(:languages_map).and_return(languages_map) + allow(subject).to receive(:GetLanguagesMap).and_return(languages_map) + end + + describe "#integrate_inst_sys_extension" do + let(:new_language) { "de_DE" } + + it "shows UI feedback and extends the inst-sys for selected language" do + allow(Yast::Popup).to receive(:ShowFeedback) + allow(Yast::Popup).to receive(:ClearFeedback) + expect(Yast::InstExtensionImage).to receive(:DownloadAndIntegrateExtension).with(/yast2-trans-.*/).and_return(true) + subject.integrate_inst_sys_extension(new_language) + end + end + + describe "#valid_language?" do + context "when checking for a known, valid language" do + it "returns true" do + expect(subject.valid_language?("pt_BR")).to eq(true) + end + end + + context "when checking for an unknown language" do + it "returns false" do + expect(subject.valid_language?("POSIX")).to eq(false) + end + end + end + + describe "#correct_language" do + context "when called with a known, valid language" do + it "returns the same unchanged language" do + allow(subject).to receive(:valid_language?).with("known_language").and_return(true) + + language = subject.correct_language("known_language") + expect(language).to eq("known_language") + end + end + + context "when called with an unknown language" do + it "reports an error and returns the default fallback language" do + allow(subject).to receive(:valid_language?).with("unknown_language").and_return(false) + expect(Yast::Report).to receive(:Error).with(/unknown_language/) + + language = subject.correct_language("unknown_language") + expect(language).to eq(Yast::LanguageClass::DEFAULT_FALLBACK_LANGUAGE) + end + end + end + + describe "#Set" do + let(:new_language) { "pt_BR" } + let(:translated_language_name) { "Português brasileiro" } + + before do + subject.language = "random_language" + + allow(subject).to receive(:correct_language).and_return(new_language) + allow(subject).to receive(:GetTextMode).and_return(false) + + expect(Yast::Encoding).to receive(:SetEncLang).with(new_language).and_return(true) + end + + after do + # Language uses a constructor that loads several system settings and + # keeps them in memory + subject.language = "random_language" + end + + context "when called in inst-sys" do + it "sets the new language, encoding integrates inst-sys extension and adapts install.inf" do + allow(Yast::Stage).to receive(:initial).and_return(true) + allow(Yast::Mode).to receive(:mode).and_return("installation") + expect(subject).to receive(:integrate_inst_sys_extension).and_return(nil) + expect(subject).to receive(:adapt_install_inf).and_return(true) + + subject.Set(new_language) + expect(subject.GetName).to eq(translated_language_name) + end + end + + context "otherwise (running system, AutoYast config, etc.)" do + it "sets the new language and encoding" do + allow(Yast::Stage).to receive(:initial).and_return(false) + allow(Yast::Mode).to receive(:mode).and_return("normal") + expect(subject).not_to receive(:integrate_inst_sys_extension) + expect(subject).not_to receive(:adapt_install_inf) + + subject.Set(new_language) + expect(subject.GetName).to eq(translated_language_name) + end + end + + # This is a special case when we start installer in non-CJK language and then switch + # to a CJK one (CJK == Chinese, Japanese, and Korean), in that case, needed fonts are + # not loaded and the UI just can't display these CJK characters + context "when called in text mode, in first stage, and user wants CJK language" do + let(:new_language) { "ja_JP" } + + it "sets language name into its English translation" do + allow(Yast::Stage).to receive(:initial).and_return(true) + allow(Yast::Mode).to receive(:mode).and_return("installation") + allow(subject).to receive(:GetTextMode).and_return(true) + + subject.Set(new_language) + expect(subject.GetName).to eq("Japanese") + end + end + end + +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/language/test/Makefile.am new/yast2-country-3.1.29/language/test/Makefile.am --- old/yast2-country-3.1.27/language/test/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-country-3.1.29/language/test/Makefile.am 2016-08-10 16:53:54.000000000 +0200 @@ -0,0 +1,12 @@ +# +# Makefile.am for autoinstallation/test +# + +TESTS = \ + Language_test.rb + +TEST_EXTENSIONS = .rb +RB_LOG_COMPILER = rspec +VERBOSE = 1 +EXTRA_DIST = $(TESTS) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/language/test/test_helper.rb new/yast2-country-3.1.29/language/test/test_helper.rb --- old/yast2-country-3.1.27/language/test/test_helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-country-3.1.29/language/test/test_helper.rb 2016-08-10 16:53:54.000000000 +0200 @@ -0,0 +1,5 @@ +root_location = File.expand_path("../../", __FILE__) +ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) + +require "yast" +require "yast/rspec" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/package/yast2-country.changes new/yast2-country-3.1.29/package/yast2-country.changes --- old/yast2-country-3.1.27/package/yast2-country.changes 2016-06-07 14:02:47.000000000 +0200 +++ new/yast2-country-3.1.29/package/yast2-country.changes 2016-08-10 16:53:54.000000000 +0200 @@ -1,4 +1,26 @@ ------------------------------------------------------------------- +Wed Aug 10 14:27:49 CEST 2016 - [email protected] + +- Added check for correct <language /> coming from an AutoYast + profile. When erroneous language is detected, then it's reported + and corrected to the default 'en_US' (bnc#991001). +- 3.1.29 + +------------------------------------------------------------------- +Mon Jul 25 14:55:00 UTC 2016 - [email protected] + +- Added support for Asturian variant of Spanish keyboard + (bsc#981008) +- Asturian variant is now the default layout for Asturian language +- 3.1.28 + +------------------------------------------------------------------- +Mon Jun 20 11:55:00 UTC 2016 - [email protected] + +- Use the eurlatg font for all languages with latin alphabet + and simplify language<->font mapping (bsc#942899, bsc#942896). + +------------------------------------------------------------------- Tue Jun 7 10:21:35 UTC 2016 - [email protected] - Stop generating autodocs (fate#320356) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/package/yast2-country.spec new/yast2-country-3.1.29/package/yast2-country.spec --- old/yast2-country-3.1.27/package/yast2-country.spec 2016-06-07 14:02:47.000000000 +0200 +++ new/yast2-country-3.1.29/package/yast2-country.spec 2016-08-10 16:53:54.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-country -Version: 3.1.27 +Version: 3.1.29 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-country-3.1.27/timezone/src/clients/timezone.rb new/yast2-country-3.1.29/timezone/src/clients/timezone.rb --- old/yast2-country-3.1.27/timezone/src/clients/timezone.rb 2016-06-07 14:02:47.000000000 +0200 +++ new/yast2-country-3.1.29/timezone/src/clients/timezone.rb 2016-08-10 16:53:54.000000000 +0200 @@ -92,7 +92,7 @@ "hwclock" => { # command line help text for 'set hwclock' option "help" => _( - "New value for hardware clock" + "New value for hardware clock. Can be 'local', 'utc' or 'UTC'." ), "type" => "enum", "typespec" => ["local", "utc", "UTC"]
