Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix outdated branded strings for oVirt and OpenStack and fix broken docs link #51

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 14 additions & 29 deletions lib/foreman_theme_satellite/branded_words.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ module ForemanThemeSatellite
# For now, modifiers are not supported by the generator.
# Make sure the regexp works both with Ruby and JavaScript.
# Entries are processed in order and first wins.
# Occurrences of "proxy" should be treated as a bug as it is unclear whether the author refers to a HTTP(S) proxy or a Capsule
FOREMAN_BRAND = {
/%{proxy}/ => '%{proxy}',
/%{foreman}/ => '%{foreman}',
/\b[Pp]roxy [Hh][Tt][Tt][Pp]\b(?!-)/ => 'Proxy HTTP', # Workaround for French translation
/\b[Pp]roxies [Hh][Tt][Tt][Pp]\b(?!-)/ => 'Proxies HTTP', # Workaround for French translation
/\b[Hh][Tt][Tt][Pp] [Pp]roxy\b(?!-)/ => 'HTTP Proxy',
/\b[Hh][Tt][Tt][Pp] [Pp]roxies\b(?!-)/ => 'HTTP Proxies',
## BEGIN Remove after imprecise strings have been fixed in core
/\b[Hh][Tt][Tt][Pp](?:\([sS]\))? [Pp]roxy\b(?!-)/ => 'HTTP proxy',
/\b[Hh][Tt][Tt][Pp](?:\([sS]\))? [Pp]roxies\b(?!-)/ => 'HTTP proxies',
/\bHTTP\(S\) proxy\b(?!-)/ => 'HTTP(S) proxy',
/\bIgnore Proxy\b(?!-)/ => 'Ignore Proxy',
/\bIgnore proxy\b(?!-)/ => 'Ignore Proxy',
Expand All @@ -24,33 +26,16 @@ module ForemanThemeSatellite
%r{\bhttps://proxy.example.com:8080\b(?!-)} => 'https://proxy.example.com:8080',
/\bproxy for all outgoing HTTP connections\b(?!-)/ => 'proxy for all outgoing HTTP connections',
/\bperform various actions through those proxies\b(?!-)/ => 'perform various actions through those proxies',
/\bForeman\b(?!-)/ => 'Satellite',
/\bforeman\b(?!-)/ => 'satellite',
/\bsmart-proxy\b(?!-)/ => 'capsule',
/\bSmart-proxy\b(?!-)/ => 'Capsule',
/\bsmart proxies\b(?!-)/ => 'capsules',
/\bSmart proxies\b(?!-)/ => 'Capsules',
/\bsmart-proxies\b(?!-)/ => 'capsules',
/\bSmart-proxies\b(?!-)/ => 'Capsules',
/\bSmart Proxies\b(?!-)/ => 'Capsules',
/\bSmart Proxy\(ies\)(?!-)/ => 'Capsule(s)',
/\bSmart Proxy\b(?!-)/ => 'Capsule',
/\bsmart proxy\b(?!-)/ => 'capsule',
/\bSmart-Proxies\b(?!-)/ => 'Capsules',
/\bSmart proxy\b(?!-)/ => 'Capsule',
/\bSmart-Proxy\b(?!-)/ => 'Capsule',
/\boVirt\b(?!-)/ => 'RHEV',
/\bovirt\b(?!-)/ => 'RHEV',
/\bOvirt\b(?!-)/ => 'RHEV',
/\bFreeIPA\b(?!-)/ => 'Red Hat Identity Management',
/\bOpenStack\b(?!-)/ => 'RHEL OpenStack Platform',
/\bopenstack\b(?!-)/ => 'RHEL OpenStack Platform',
/\bOpenstack\b(?!-)/ => 'RHEL OpenStack Platform',
/\bProxy\b(?!-)/ => 'Capsule',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need those, while imprecise string are in the core.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-added a check for proxy/proxies. OpenStack branding is already covered by line 35.

/\bproxy\b(?!-)/ => 'Capsule',
/\bProxies\b(?!-)/ => 'Capsules',
/\bproxies\b(?!-)/ => 'Capsules',
/\b[Kk]atello 4.0\b(?!-)/ => 'Satellite 6.11',
## END
/\b[Ff]oreman\b(?!-)/ => 'Satellite',
/\b[Ss]mart[- ]?[pP]roxy\b(?!-)/ => 'Capsule',
/\b[Ss]mart[- ]?[pP]roxies\b(?!-)/ => 'Capsules',
/\b[Pp]roxy\b(?!-)/ => 'Capsule',
/\b[Pp]roxies\b(?!-)/ => 'Capsules',
/\b[Oo][Vv]irt\b(?!-)/ => 'RHV',
/\bFreeIPA\b(?!-)/ => 'Red Hat Identity Management',
/\b[Oo]pen[Ss]tack\b(?!-)/ => 'Red Hat OpenStack Platform',
/\b[Kk]atello 4.0\b(?!-)/ => 'Satellite 6.11',
/\b[Kk]atello 4.10\b(?!-)/ => 'Satellite 6.15',
/\b[Kk]atello 4.11\b(?!-)/ => 'Satellite 6.15',
/\b[Kk]atello 4.12\b(?!-)/ => 'Satellite 6.16',
Expand Down
26 changes: 24 additions & 2 deletions test/unit/replacer_repository_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,30 @@ class TranslationsTest < ActiveSupport::TestCase
end

test 'Can work with whitelist branding' do
actual = _('HTTP proxy for proxy')
actual = _('http proxy for smart proxy')

assert_equal 'HTTP Proxy for Capsule', actual
assert_equal 'HTTP proxy for Capsule', actual
end

test 'random branding test' do
# Tests branding based on strings randomly picked from Foreman- and Satellite-documentation
test_strings = [
'An operating system is a collection of resources that define how Foreman server installs a base operating system on a host.',
'Installing the Infoblox CA certificate on Smart Proxy server',
'In the Foreman web UI, navigate to Infrastructure > Smart Proxies, select the Smart Proxy with the DHCP Infoblox module, and ensure that the dhcp feature is listed.',
'Foreman Server automatically manages the PXE configuration, organizes networking services, and provides the operating system and configuration for the host.',
'In Foreman, you can create an HTTP proxy and then assign the HTTP proxy to your EC2 compute resource.',
]
translated_strings = [
'An operating system is a collection of resources that define how Satellite server installs a base operating system on a host.', # Pr. Hosts: 2.3
'Installing the Infoblox CA certificate on Capsule server', # Pr. Hosts: 4.3
'In the Satellite web UI, navigate to Infrastructure > Capsules, select the Capsule with the DHCP Infoblox module, and ensure that the dhcp feature is listed.', # Pr. Hosts: 4.4
'Satellite Server automatically manages the PXE configuration, organizes networking services, and provides the operating system and configuration for the host.', # Pr. Hosts: 5.3
'In Satellite, you can create an HTTP proxy and then assign the HTTP proxy to your EC2 compute resource.', # Pr. Hosts: 14.4
]

test_strings.zip(translated_strings).each do |original, target|
assert_equal target, _(original)
end
end
end
Loading