From 3f63fd8ade57023c07c6ef0c26f64b1a3ee5bfb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 16 Nov 2023 14:55:11 +0100 Subject: [PATCH 1/3] Pass the changed language to the Software service and to libzypp --- service/lib/agama/dbus/manager_service.rb | 2 +- service/lib/agama/dbus/software_service.rb | 19 ++++++++++++++++--- service/lib/agama/dbus/storage_service.rb | 2 +- 3 files changed, 18 insertions(+), 5 deletions(-) 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..1a696e992a 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,19 @@ 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) 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 From f7fd50aaa2893a51bb25d3080386e38150421055 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 16 Nov 2023 17:29:30 +0100 Subject: [PATCH 2/3] Comment + changes --- service/lib/agama/dbus/software_service.rb | 2 ++ service/package/rubygem-agama.changes | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/service/lib/agama/dbus/software_service.rb b/service/lib/agama/dbus/software_service.rb index 1a696e992a..3f357bb000 100644 --- a/service/lib/agama/dbus/software_service.rb +++ b/service/lib/agama/dbus/software_service.rb @@ -55,6 +55,8 @@ def initialize(config, logger = nil) # Starts software service. It does more then just #export method. def start + # 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| diff --git a/service/package/rubygem-agama.changes b/service/package/rubygem-agama.changes index 882ca7c2d7..eac4253b81 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 + ------------------------------------------------------------------- Wed Nov 15 12:31:10 UTC 2023 - José Iván López González From 48448c8a1e81d141a0485b9dc506df198eb34cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 16 Nov 2023 17:33:20 +0100 Subject: [PATCH 3/3] Update service/package/rubygem-agama.changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Imobach González Sosa --- service/package/rubygem-agama.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/package/rubygem-agama.changes b/service/package/rubygem-agama.changes index eac4253b81..2c9d28c3a7 100644 --- a/service/package/rubygem-agama.changes +++ b/service/package/rubygem-agama.changes @@ -2,7 +2,7 @@ Thu Nov 16 16:27:37 UTC 2023 - Ladislav Slezák - Software service - correctly change the locale, pass the changed - locale to libzypp + locale to libzypp (gh#openSUSE/agama#875). ------------------------------------------------------------------- Wed Nov 15 12:31:10 UTC 2023 - José Iván López González