Skip to content

Commit

Permalink
Merge pull request #300 from yast/huha-fix-lang-cache-SLE-15-SP4
Browse files Browse the repository at this point in the history
Update Language Cache when Selecting new Language [SLE-15 SP4]
  • Loading branch information
shundhammer committed Nov 24, 2022
2 parents c02d61f + 87f6144 commit f0fb26c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
35 changes: 12 additions & 23 deletions language/src/modules/Language.rb
Expand Up @@ -176,6 +176,7 @@ def GetTextMode

# Read language DB: translatable strings will be translated to current language
def read_languages_map
log.info("Reading languages map; @language: #{@language}")
Builtins.foreach(
Convert.convert(
SCR.Read(path(".target.dir"), @languages_directory, []),
Expand Down Expand Up @@ -454,28 +455,26 @@ def adapt_install_inf
def Set(lang)
lang = deep_copy(lang)

Builtins.y2milestone(
"original language: %1; setting to lang:%2",
@language,
lang
)

if @language != lang
log.info("Language changed from #{@language} to #{lang}")

lang = correct_language(lang)
@language = lang

if Stage.initial && !Mode.test && !Mode.live_installation
integrate_inst_sys_extension(lang)
end

GetLocales() if Builtins.size(@locales) == 0

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)
else
log.info("Language unchanged: #{@language}")
end

if Stage.initial && !Mode.test
Expand Down Expand Up @@ -695,8 +694,6 @@ def PackagesModified
)
end

# GetExpertValues()
#
# Return the values for the various expert settings in a map
#
# @param -
Expand All @@ -707,8 +704,6 @@ def GetExpertValues
{ "use_utf8" => @use_utf8 }
end

# SetExpertValues()
#
# Set the values of the various expert setting
#
# @param [Hash] val map with new values of expert settings
Expand All @@ -725,8 +720,6 @@ def SetExpertValues(val)
nil
end

# WfmSetLanguag()
#
# Set the given language in WFM and UI
#
# @param language (could be different from current in CJK case)
Expand All @@ -736,13 +729,7 @@ def WfmSetGivenLanguage(lang)
return if Mode.config

encoding = @use_utf8 ? "UTF-8" : Encoding.console

Builtins.y2milestone(
"language %1 enc %2 utf8:%3",
lang,
encoding,
@use_utf8
)
log.info("Language changed from #{@language} to #{lang} encoding: #{encoding} use_utf8: #{@use_utf8}")

UI.SetLanguage(lang, encoding)

Expand All @@ -752,18 +739,20 @@ def WfmSetGivenLanguage(lang)
WFM.SetLanguage(lang)
end

# Force rebuilding the languages map to make sure the correct translations are used
read_languages_map

nil
end


# WfmSetLanguag()
#
# Set the current language in WFM and UI
#
# @param -
#
# @return -
def WfmSetLanguage
log.info("Setting the current language")
WfmSetGivenLanguage(@language)

nil
Expand Down
9 changes: 9 additions & 0 deletions package/yast2-country.changes
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Nov 24 11:50:41 UTC 2022 - Stefan Hundhammer <shundhammer@suse.com>

- Update language cache when selecting new language to ensure that
always the correct language translations are used in the license
translations selection combo box on the next wizard page
(bsc#1204845, bsc#1193009)
- 4.4.13

-------------------------------------------------------------------
Mon Mar 14 12:03:14 UTC 2022 - Stefan Hundhammer <shundhammer@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-country.spec
Expand Up @@ -16,7 +16,7 @@
#

Name: yast2-country
Version: 4.4.12
Version: 4.4.13
Release: 0
Summary: YaST2 - Country Settings (Language, Keyboard, and Timezone)
License: GPL-2.0-only
Expand Down

0 comments on commit f0fb26c

Please sign in to comment.