Skip to content

Commit

Permalink
fix: Mark strings for translation
Browse files Browse the repository at this point in the history
Mark strings that previously were not marked for translation, making the
UI show text partially in English and partially on another language on
some dialogs.

Changed shared dialog classes to assume instance variables holds already
localized strings, no need to further call gettext functions on them.
This means classes that inherit these shared ones should no longer use
'N_(...)', but instead '_(...)'.

Refs: bsc#1127676
  • Loading branch information
lcaparroz committed Mar 5, 2025
1 parent c5ca0d0 commit b7718e8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
7 changes: 4 additions & 3 deletions src/lib/rmt/maria_db/current_root_password_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ module RMT::MariaDB; end

class RMT::MariaDB::CurrentRootPasswordDialog < RMT::Shared::InputPasswordDialog
def initialize
textdomain 'rmt'
super

@dialog_heading = N_('Database root password is required')
@dialog_label = N_('In order to setup RMT, database access is required. Please provide the current database root password.')
@password_field_label = N_('MariaDB root &password')
@dialog_heading = _('Database root password is required')
@dialog_label = _('In order to setup RMT, database access is required. Please provide the current database root password.')
@password_field_label = _('MariaDB root &password')
end

private
Expand Down
7 changes: 4 additions & 3 deletions src/lib/rmt/maria_db/new_root_password_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ module RMT::MariaDB; end

class RMT::MariaDB::NewRootPasswordDialog < RMT::Shared::SetPasswordDialog
def initialize
textdomain 'rmt'
super

@dialog_heading = N_('Setting database root password')
@dialog_label = N_('The current MariaDB root password is empty. Setting a root password is required for security reasons.')
@password_field_label = N_('New MariaDB root &Password')
@dialog_heading = _('Setting database root password')
@dialog_label = _('The current MariaDB root password is empty. Setting a root password is required for security reasons.')
@password_field_label = _('New MariaDB root &Password')
end

def set_root_password(new_root_password, hostname)
Expand Down
6 changes: 3 additions & 3 deletions src/lib/rmt/shared/input_password_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def ok_handler
def dialog_content
VBox(
VSpacing(1),
Heading(_(@dialog_heading)),
Heading(@dialog_heading),
VSpacing(1),
HBox(
HSpacing(2),
VBox(
Label(_(@dialog_label)),
Label(@dialog_label),
VSpacing(1),
MinWidth(15, Password(Id(:password), _(@password_field_label)))
MinWidth(15, Password(Id(:password), @password_field_label))
),
HSpacing(2)
),
Expand Down
14 changes: 5 additions & 9 deletions src/lib/rmt/shared/set_password_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module RMT::Shared; end
class RMT::Shared::SetPasswordDialog < UI::Dialog
def initialize
@min_password_size = 0
@password_confirmation_field_label = N_('C&onfirm Password')
@password_confirmation_field_label = _('C&onfirm Password')
textdomain 'rmt'
end

Expand Down Expand Up @@ -60,19 +60,15 @@ def ok_handler
def dialog_content
VBox(
VSpacing(1),
Heading(_(@dialog_heading)),
Heading(@dialog_heading),
VSpacing(1),
HBox(
HSpacing(2),
VBox(
Label(
_(
@dialog_label
)
),
Label(@dialog_label),
VSpacing(1),
MinWidth(15, Password(Id(:password), _(@password_field_label))),
MinWidth(15, Password(Id(:password_confirmation), _(@password_confirmation_field_label)))
MinWidth(15, Password(Id(:password), @password_field_label)),
MinWidth(15, Password(Id(:password_confirmation), @password_confirmation_field_label))
),
HSpacing(2)
),
Expand Down
7 changes: 4 additions & 3 deletions src/lib/rmt/ssl/current_ca_password_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ module RMT::SSL; end

class RMT::SSL::CurrentCaPasswordDialog < RMT::Shared::InputPasswordDialog
def initialize
textdomain 'rmt'
super

@dialog_heading = N_('Your CA private key is encrypted.')
@dialog_label = N_('Please input password.')
@password_field_label = N_('&Password')
@dialog_heading = _('Your CA private key is encrypted.')
@dialog_label = _('Please input password.')
@password_field_label = _('&Password')
@cert_generator = RMT::SSL::CertificateGenerator.new
end

Expand Down
7 changes: 4 additions & 3 deletions src/lib/rmt/ssl/new_ca_password_dialog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ module RMT::SSL; end

class RMT::SSL::NewCaPasswordDialog < RMT::Shared::SetPasswordDialog
def initialize
textdomain 'rmt'
super

@dialog_heading = N_('Setting CA private key password')
@dialog_label = N_('Please set a password for the CA private key.')
@password_field_label = N_('&Password')
@dialog_heading = _('Setting CA private key password')
@dialog_label = _('Please set a password for the CA private key.')
@password_field_label = _('&Password')
@min_password_size = 4
end
end

0 comments on commit b7718e8

Please sign in to comment.