Skip to content

Commit

Permalink
Pass the changed language to the Software service and to libzypp
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Nov 16, 2023
1 parent e6e6e6b commit 3f63fd8
Show file tree
Hide file tree
Showing 3 changed files with 18 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
19 changes: 16 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,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
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

0 comments on commit 3f63fd8

Please sign in to comment.