Skip to content

Commit f78f229

Browse files
authored
Fix outdated branded words: (#51)
- Red Hat Virtualization: Change from "RHEV" to "RHV" - Red Hat Openstack Platform: Change from "RHEL Openstack Platform" to "Red Hat Openstack Platform" - Fix link to docs for registering hosts using bootstrap script - Simplify regular expressions - Add test based on documentation strings
1 parent c10c3d6 commit f78f229

2 files changed

Lines changed: 38 additions & 31 deletions

File tree

lib/foreman_theme_satellite/branded_words.rb

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ module ForemanThemeSatellite
77
# For now, modifiers are not supported by the generator.
88
# Make sure the regexp works both with Ruby and JavaScript.
99
# Entries are processed in order and first wins.
10+
# 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
1011
FOREMAN_BRAND = {
1112
/%{proxy}/ => '%{proxy}',
1213
/%{foreman}/ => '%{foreman}',
1314
/\b[Pp]roxy [Hh][Tt][Tt][Pp]\b(?!-)/ => 'Proxy HTTP', # Workaround for French translation
1415
/\b[Pp]roxies [Hh][Tt][Tt][Pp]\b(?!-)/ => 'Proxies HTTP', # Workaround for French translation
15-
/\b[Hh][Tt][Tt][Pp] [Pp]roxy\b(?!-)/ => 'HTTP Proxy',
16-
/\b[Hh][Tt][Tt][Pp] [Pp]roxies\b(?!-)/ => 'HTTP Proxies',
16+
## BEGIN Remove after imprecise strings have been fixed in core
17+
/\b[Hh][Tt][Tt][Pp](?:\([sS]\))? [Pp]roxy\b(?!-)/ => 'HTTP proxy',
18+
/\b[Hh][Tt][Tt][Pp](?:\([sS]\))? [Pp]roxies\b(?!-)/ => 'HTTP proxies',
1719
/\bHTTP\(S\) proxy\b(?!-)/ => 'HTTP(S) proxy',
1820
/\bIgnore Proxy\b(?!-)/ => 'Ignore Proxy',
1921
/\bIgnore proxy\b(?!-)/ => 'Ignore Proxy',
@@ -24,33 +26,16 @@ module ForemanThemeSatellite
2426
%r{\bhttps://proxy.example.com:8080\b(?!-)} => 'https://proxy.example.com:8080',
2527
/\bproxy for all outgoing HTTP connections\b(?!-)/ => 'proxy for all outgoing HTTP connections',
2628
/\bperform various actions through those proxies\b(?!-)/ => 'perform various actions through those proxies',
27-
/\bForeman\b(?!-)/ => 'Satellite',
28-
/\bforeman\b(?!-)/ => 'satellite',
29-
/\bsmart-proxy\b(?!-)/ => 'capsule',
30-
/\bSmart-proxy\b(?!-)/ => 'Capsule',
31-
/\bsmart proxies\b(?!-)/ => 'capsules',
32-
/\bSmart proxies\b(?!-)/ => 'Capsules',
33-
/\bsmart-proxies\b(?!-)/ => 'capsules',
34-
/\bSmart-proxies\b(?!-)/ => 'Capsules',
35-
/\bSmart Proxies\b(?!-)/ => 'Capsules',
36-
/\bSmart Proxy\(ies\)(?!-)/ => 'Capsule(s)',
37-
/\bSmart Proxy\b(?!-)/ => 'Capsule',
38-
/\bsmart proxy\b(?!-)/ => 'capsule',
39-
/\bSmart-Proxies\b(?!-)/ => 'Capsules',
40-
/\bSmart proxy\b(?!-)/ => 'Capsule',
41-
/\bSmart-Proxy\b(?!-)/ => 'Capsule',
42-
/\boVirt\b(?!-)/ => 'RHEV',
43-
/\bovirt\b(?!-)/ => 'RHEV',
44-
/\bOvirt\b(?!-)/ => 'RHEV',
45-
/\bFreeIPA\b(?!-)/ => 'Red Hat Identity Management',
46-
/\bOpenStack\b(?!-)/ => 'RHEL OpenStack Platform',
47-
/\bopenstack\b(?!-)/ => 'RHEL OpenStack Platform',
48-
/\bOpenstack\b(?!-)/ => 'RHEL OpenStack Platform',
49-
/\bProxy\b(?!-)/ => 'Capsule',
50-
/\bproxy\b(?!-)/ => 'Capsule',
51-
/\bProxies\b(?!-)/ => 'Capsules',
52-
/\bproxies\b(?!-)/ => 'Capsules',
53-
/\b[Kk]atello 4.0\b(?!-)/ => 'Satellite 6.11',
29+
## END
30+
/\b[Ff]oreman\b(?!-)/ => 'Satellite',
31+
/\b[Ss]mart[- ]?[pP]roxy\b(?!-)/ => 'Capsule',
32+
/\b[Ss]mart[- ]?[pP]roxies\b(?!-)/ => 'Capsules',
33+
/\b[Pp]roxy\b(?!-)/ => 'Capsule',
34+
/\b[Pp]roxies\b(?!-)/ => 'Capsules',
35+
/\b[Oo][Vv]irt\b(?!-)/ => 'RHV',
36+
/\bFreeIPA\b(?!-)/ => 'Red Hat Identity Management',
37+
/\b[Oo]pen[Ss]tack\b(?!-)/ => 'Red Hat OpenStack Platform',
38+
/\b[Kk]atello 4.0\b(?!-)/ => 'Satellite 6.11',
5439
/\b[Kk]atello 4.10\b(?!-)/ => 'Satellite 6.15',
5540
/\b[Kk]atello 4.11\b(?!-)/ => 'Satellite 6.15',
5641
/\b[Kk]atello 4.12\b(?!-)/ => 'Satellite 6.16',

test/unit/replacer_repository_test.rb

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,30 @@ class TranslationsTest < ActiveSupport::TestCase
1414
end
1515

1616
test 'Can work with whitelist branding' do
17-
actual = _('HTTP proxy for proxy')
17+
actual = _('http proxy for smart proxy')
1818

19-
assert_equal 'HTTP Proxy for Capsule', actual
19+
assert_equal 'HTTP proxy for Capsule', actual
20+
end
21+
22+
test 'random branding test' do
23+
# Tests branding based on strings randomly picked from Foreman- and Satellite-documentation
24+
test_strings = [
25+
'An operating system is a collection of resources that define how Foreman server installs a base operating system on a host.',
26+
'Installing the Infoblox CA certificate on Smart Proxy server',
27+
'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.',
28+
'Foreman Server automatically manages the PXE configuration, organizes networking services, and provides the operating system and configuration for the host.',
29+
'In Foreman, you can create an HTTP proxy and then assign the HTTP proxy to your EC2 compute resource.',
30+
]
31+
translated_strings = [
32+
'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
33+
'Installing the Infoblox CA certificate on Capsule server', # Pr. Hosts: 4.3
34+
'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
35+
'Satellite Server automatically manages the PXE configuration, organizes networking services, and provides the operating system and configuration for the host.', # Pr. Hosts: 5.3
36+
'In Satellite, you can create an HTTP proxy and then assign the HTTP proxy to your EC2 compute resource.', # Pr. Hosts: 14.4
37+
]
38+
39+
test_strings.zip(translated_strings).each do |original, target|
40+
assert_equal target, _(original)
41+
end
2042
end
2143
end

0 commit comments

Comments
 (0)