Skip to content

Commit

Permalink
Fixes #36389 - Translation improvements
Browse files Browse the repository at this point in the history
* Extract missing strings for the translations
* Fix interpolations in strings
* Update config for the transifex-cli
* Update *.po files
  • Loading branch information
stejskalleos authored and chris1984 committed May 17, 2023
1 parent 8483603 commit 330f9e7
Show file tree
Hide file tree
Showing 41 changed files with 177 additions and 3,862 deletions.
14 changes: 8 additions & 6 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[main]
host = https://www.transifex.com
host = https://app.transifex.com

[foreman.foreman_azure_rm]
file_filter = locale/<lang>/foreman_azure_rm.edit.po
source_file = locale/foreman_azure_rm.pot
source_lang = en
type = PO
[o:foreman:p:foreman:r:foreman_azure_rm]
file_filter = locale/<lang>/foreman_azure_rm.edit.po
source_file = locale/foreman_azure_rm.pot
source_lang = en
type = PO
minimum_perc = 0
resource_name = foreman_azure_rm
6 changes: 3 additions & 3 deletions app/models/foreman_azure_rm/azure_rm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def cloud=(name)
def sdk
@sdk ||= ForemanAzureRm::AzureSdkAdapter.new(tenant, app_ident, secret_key, sub_id, azure_environment)
end

def to_label
"#{name} (#{provider_friendly_name})"
end
Expand All @@ -64,13 +64,13 @@ def ensure_attributes_and_values

def validate_region
return unless regions.present?
errors.add(:region, "is not valid, must be lowercase eg. 'eastus'. No special characters allowed.") unless regions.collect(&:second).include?(region)
errors.add(:region, _("is not valid, must be lowercase eg. 'eastus'. No special characters allowed.")) unless regions.collect(&:second).include?(region)
end

def validate_cloud?
valid_clouds = ['azure', 'azureusgovernment', 'azurechina', 'azuregermancloud']
unless valid_clouds.include?(cloud)
errors.add(:cloud, "is not valid. Valid choices are #{valid_clouds.join(", ")}.")
errors.add(:cloud, _("is not valid. Valid choices are %s.") % valid_clouds.join(", "))
return false
end
true
Expand Down
9 changes: 2 additions & 7 deletions lib/foreman_azure_rm/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class Engine < ::Rails::Engine

initializer 'foreman_azure_rm.register_plugin', :before => :finisher_hook do
Foreman::Plugin.register :foreman_azure_rm do
requires_foreman '>= 1.17'
requires_foreman '>= 3.7'
register_gettext
compute_resource ForemanAzureRm::AzureRm
parameter_filter ComputeResource, :azure_vm, :tenant, :app_ident, :secret_key, :sub_id, :region, :cloud
end
Expand All @@ -28,12 +29,6 @@ class Engine < ::Rails::Engine
end
end

initializer 'foreman_azure_rm.register_gettext', after: :load_config_initializers do
locale_dir = File.join(File.expand_path('../../../', __FILE__), 'locale')
locale_domain = 'foreman_azure_rm'
Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
end

config.to_prepare do
require 'azure_mgmt_resources'
require 'azure_mgmt_network'
Expand Down
Binary file modified locale/ca/LC_MESSAGES/foreman_azure_rm.mo
Binary file not shown.
Loading

0 comments on commit 330f9e7

Please sign in to comment.