diff --git a/service/lib/agama/dbus/manager_service.rb b/service/lib/agama/dbus/manager_service.rb index 1e39c41620..4c73938a0f 100644 --- a/service/lib/agama/dbus/manager_service.rb +++ b/service/lib/agama/dbus/manager_service.rb @@ -71,11 +71,11 @@ def initialize(config, logger = nil) # @note The service runs its startup phase def start setup_cockpit + export # We need locale for data from users locale_client = Clients::Locale.new # TODO: test if we need to pass block with additional actions @ui_locale = UILocale.new(locale_client) - export manager.on_progress_change { dispatch } # make single thread more responsive manager.startup_phase end diff --git a/service/lib/agama/dbus/software_service.rb b/service/lib/agama/dbus/software_service.rb index 1ce788a18e..3f357bb000 100644 --- a/service/lib/agama/dbus/software_service.rb +++ b/service/lib/agama/dbus/software_service.rb @@ -26,6 +26,10 @@ require "agama/software" require "agama/ui_locale" +require "yast" +Yast.import "Pkg" +Yast.import "Language" + module Agama module DBus # D-Bus service (org.opensuse.Agama.Software1) @@ -51,10 +55,21 @@ def initialize(config, logger = nil) # Starts software service. It does more then just #export method. def start - locale_client = Clients::Locale.new - # TODO: test if we need to pass block with additional actions - @ui_locale = UILocale.new(locale_client) + # for some reason the the "export" method must be called before + # registering the language change callback to work properly export + locale_client = Clients::Locale.new + @ui_locale = UILocale.new(locale_client) do |locale| + # set the locale in the Language module, when changing the repository + # (product) it calls Pkg.SetTextLocale(Language.language) internally + Yast::Language.Set(locale) + # set libzypp locale (for communication only, Pkg.SetPackageLocale + # call can be used for installing the language packages) + Yast::Pkg.SetTextLocale(locale) + # TODO: libzypp shows the pattern names and descriptions using the + # locale set at the repository refresh time, here we should refresh + # the repositories with the new locale + end end # Exports the software object through the D-Bus service diff --git a/service/lib/agama/dbus/storage_service.rb b/service/lib/agama/dbus/storage_service.rb index 98f9942454..773e37a3e9 100644 --- a/service/lib/agama/dbus/storage_service.rb +++ b/service/lib/agama/dbus/storage_service.rb @@ -52,10 +52,10 @@ def bus # Starts storage service. It does more then just #export method. def start + export locale_client = Clients::Locale.new # TODO: test if we need to pass block with additional actions @ui_locale = UILocale.new(locale_client) - export end # Exports the storage proposal object through the D-Bus service diff --git a/service/package/rubygem-agama.changes b/service/package/rubygem-agama.changes index 882ca7c2d7..2c9d28c3a7 100644 --- a/service/package/rubygem-agama.changes +++ b/service/package/rubygem-agama.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Nov 16 16:27:37 UTC 2023 - Ladislav Slezák + +- Software service - correctly change the locale, pass the changed + locale to libzypp (gh#openSUSE/agama#875). + ------------------------------------------------------------------- Wed Nov 15 12:31:10 UTC 2023 - José Iván López González