Skip to content

Commit

Permalink
Merge pull request #875 from openSUSE/sw_service_language
Browse files Browse the repository at this point in the history
Pass the changed language to the Software service and to libzypp
  • Loading branch information
lslezak committed Nov 16, 2023
2 parents e6e6e6b + 48448c8 commit 7785807
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion service/lib/agama/dbus/manager_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 18 additions & 3 deletions service/lib/agama/dbus/software_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion service/lib/agama/dbus/storage_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions service/package/rubygem-agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Nov 16 16:27:37 UTC 2023 - Ladislav Slezák <lslezak@suse.com>

- 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 <jlopez@suse.com>

Expand Down

0 comments on commit 7785807

Please sign in to comment.