From 571df0a5abb806cb91a8121b2d5e1f851e45941f Mon Sep 17 00:00:00 2001 From: Carlos Cesario Date: Fri, 5 Dec 2014 10:45:10 -0200 Subject: [PATCH 1/4] Improve plural string translation Improve plural translation for some statements refs #8000 --- .../views/scripts/list/hostgroups.phtml | 2 +- .../views/scripts/list/servicegroups.phtml | 2 +- .../show/components/hostservicesummary.phtml | 2 +- .../tactical/components/hostservicechecks.phtml | 12 ++++++------ .../tactical/components/monitoringfeatures.phtml | 16 ++++++++-------- .../scripts/tactical/components/ok_hosts.phtml | 4 ++-- .../parts/servicestatesummarybyhoststate.phtml | 6 +++--- .../tactical/components/problem_hosts.phtml | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/modules/monitoring/application/views/scripts/list/hostgroups.phtml b/modules/monitoring/application/views/scripts/list/hostgroups.phtml index 2b8ad6c4f..a15b5be7e 100644 --- a/modules/monitoring/application/views/scripts/list/hostgroups.phtml +++ b/modules/monitoring/application/views/scripts/list/hostgroups.phtml @@ -222,4 +222,4 @@ - \ No newline at end of file + diff --git a/modules/monitoring/application/views/scripts/list/servicegroups.phtml b/modules/monitoring/application/views/scripts/list/servicegroups.phtml index b7898de05..ceb3929c0 100644 --- a/modules/monitoring/application/views/scripts/list/servicegroups.phtml +++ b/modules/monitoring/application/views/scripts/list/servicegroups.phtml @@ -222,4 +222,4 @@ - \ No newline at end of file + diff --git a/modules/monitoring/application/views/scripts/show/components/hostservicesummary.phtml b/modules/monitoring/application/views/scripts/show/components/hostservicesummary.phtml index f42e70278..3c603786a 100644 --- a/modules/monitoring/application/views/scripts/show/components/hostservicesummary.phtml +++ b/modules/monitoring/application/views/scripts/show/components/hostservicesummary.phtml @@ -7,7 +7,7 @@ $currentUrl = Url::fromRequest()->without('limit')->getRelativeUrl(); ?>

compact ? ' data-base-target="col1"' : '' ?>> stats->services_total > 0): ?> -qlink(sprintf($this->translate('%s configured services:'), $object->stats->services_total), $selfUrl) ?> +qlink(sprintf($this->translatePlural('%d configured service:', '%d configured services:', $object->stats->services_total), $object->stats->services_total), $selfUrl) ?> translate('No services configured on this host'); ?> diff --git a/modules/monitoring/application/views/scripts/tactical/components/hostservicechecks.phtml b/modules/monitoring/application/views/scripts/tactical/components/hostservicechecks.phtml index 5949a84d8..52aeb5c54 100644 --- a/modules/monitoring/application/views/scripts/tactical/components/hostservicechecks.phtml +++ b/modules/monitoring/application/views/scripts/tactical/components/hostservicechecks.phtml @@ -17,7 +17,7 @@ 'monitoring/list/hosts', array('host_active_checks_enabled' => 1) ); ?>"> - statusSummary->hosts_active . ' ' . $this->translate('Active'); ?> + translatePlural('%d Active', '%d Active', $this->statusSummary->hosts_active), $this->statusSummary->hosts_active); ?> @@ -27,7 +27,7 @@ 'monitoring/list/hosts', array('host_active_checks_enabled' => 0, 'host_passive_checks_enabled' => 1) ); ?>"> - statusSummary->hosts_passive . ' ' . $this->translate('Passive'); ?> + translatePlural('%d Passive', '%d Passive', $this->statusSummary->hosts_passive), $this->statusSummary->hosts_passive); ?> @@ -37,7 +37,7 @@ 'monitoring/list/hosts', array('host_active_checks_enabled' => 0, 'host_passive_checks_enabled' => 0) ); ?>" style="color: red;"> - statusSummary->hosts_not_checked . ' ' . $this->translate('Disabled'); ?> + translatePlural('%d Disabled', '%d Disabled', $this->statusSummary->hosts_not_checked), $this->statusSummary->hosts_not_checked); ?> @@ -49,7 +49,7 @@ 'monitoring/list/services', array('service_active_checks_enabled' => 1) ); ?>"> - statusSummary->services_active . ' ' . $this->translate('Active'); ?> + translatePlural('%d Active', '%d Active', $this->statusSummary->services_active), $this->statusSummary->services_active); ?> @@ -59,7 +59,7 @@ 'monitoring/list/services', array('service_active_checks_enabled' => 0, 'service_passive_checks_enabled' => 1) ); ?>"> - statusSummary->services_passive . ' ' . $this->translate('Passive'); ?> + statusSummary->services_passive . ' ' . $this->translatePlural('Passive', 'Passive', $this->statusSummary->services_passive); ?> @@ -69,7 +69,7 @@ 'monitoring/list/services', array('service_active_checks_enabled' => 0, 'service_passive_checks_enabled' => 0) ); ?>" style="color: red;"> - statusSummary->services_not_checked . ' ' . $this->translate('Disabled'); ?> + translatePlural('%d Disabled', '%d Disabled', $this->statusSummary->services_not_checked), $this->statusSummary->services_not_checked); ?> diff --git a/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml b/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml index 8e6d35221..2428e0d40 100644 --- a/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml +++ b/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml @@ -17,7 +17,7 @@ 'monitoring/list/hosts', array('host_flap_detection_enabled' => 0) ); ?>" class="feature-highlight"> - translate('%d hosts disabled'), $this->statusSummary->hosts_without_flap_detection); ?> + translatePlural('%d host disabled', '%d hosts disabled', $this->statusSummary->hosts_without_flap_detection), $this->statusSummary->hosts_without_flap_detection); ?>
@@ -33,7 +33,7 @@ 'monitoring/list/hosts', array('host_is_flapping' => 1) ); ?>" class="feature-highlight"> - translate('%d hosts flapping'), $this->statusSummary->hosts_flapping); ?> + translatePlural('%d host flapping', '%d hosts flapping', $this->statusSummary->hosts_flapping), $this->statusSummary->hosts_flapping); ?>
@@ -45,7 +45,7 @@ 'monitoring/list/services', array('service_flap_detection_enabled' => 0) ); ?>" class="feature-highlight"> - translate('%d services disabled'), $this->statusSummary->services_without_flap_detection); ?> + translatePlural('%d service disabled', '%d services disabled', $this->statusSummary->services_without_flap_detection), $this->statusSummary->services_without_flap_detection); ?>
@@ -61,7 +61,7 @@ 'monitoring/list/services', array('service_is_flapping' => 1) ); ?>" class="feature-highlight"> - translate('%d services flapping'), $this->statusSummary->services_flapping); ?> + translatePlural('%d service flapping', '%d services flapping', $this->statusSummary->services_flapping), $this->statusSummary->services_flapping); ?>
@@ -84,7 +84,7 @@ 'monitoring/list/hosts', array('host_notifications_enabled' => 0) ); ?>" class="feature-highlight"> - translate('%d hosts disabled'), $this->statusSummary->hosts_not_triggering_notifications); ?> + translatePlural('%d host disabled', '%d hosts disabled', $this->statusSummary->hosts_not_triggering_notifications), $this->statusSummary->hosts_not_triggering_notifications); ?>
@@ -104,7 +104,7 @@ 'monitoring/list/services', array('service_notifications_enabled' => 0) ); ?>" class="feature-highlight"> - translate('%d services disabled'), $this->statusSummary->services_not_triggering_notifications); ?> + translatePlural('%d service disabled', '%d services disabled', $this->statusSummary->services_not_triggering_notifications), $this->statusSummary->services_not_triggering_notifications); ?>
@@ -135,7 +135,7 @@ 'monitoring/list/hosts', array('host_event_handler_enabled' => 0) ); ?>" class="feature-highlight"> - translate('%d hosts disabled'), $this->statusSummary->hosts_not_processing_event_handlers); ?> + translatePlural('%d host disabled', '%d hosts disabled', $this->statusSummary->hosts_not_processing_event_handlers), $this->statusSummary->hosts_not_processing_event_handlers); ?>
@@ -155,7 +155,7 @@ 'monitoring/list/services', array('service_event_handler_enabled' => 0) ); ?>" class="feature-highlight"> - translate('%d services disabled'), $this->statusSummary->services_not_processing_event_handlers); ?> + translatePlural('%d service disabled', '%d services disabled', $this->statusSummary->services_not_processing_event_handlers), $this->statusSummary->services_not_processing_event_handlers); ?>
diff --git a/modules/monitoring/application/views/scripts/tactical/components/ok_hosts.phtml b/modules/monitoring/application/views/scripts/tactical/components/ok_hosts.phtml index 0543f58c5..cc9328262 100644 --- a/modules/monitoring/application/views/scripts/tactical/components/ok_hosts.phtml +++ b/modules/monitoring/application/views/scripts/tactical/components/ok_hosts.phtml @@ -12,14 +12,14 @@ $service_problems = ( statusSummary->hosts_up): ?>

- translate('%d Hosts UP'), $this->statusSummary->hosts_up); ?> + translatePlural('%d Host UP', '%d Hosts UP', $this->statusSummary->hosts_up), $this->statusSummary->hosts_up); ?>

statusSummary->hosts_pending): ?>

- translate('%d Hosts PENDING'), $this->statusSummary->hosts_pending); ?> + translatePlural('%d Host PENDING', '%d Hosts PENDING', $this->statusSummary->hosts_pending), $this->statusSummary->hosts_pending); ?>

diff --git a/modules/monitoring/application/views/scripts/tactical/components/parts/servicestatesummarybyhoststate.phtml b/modules/monitoring/application/views/scripts/tactical/components/parts/servicestatesummarybyhoststate.phtml index cccfa094e..a5f3749e8 100644 --- a/modules/monitoring/application/views/scripts/tactical/components/parts/servicestatesummarybyhoststate.phtml +++ b/modules/monitoring/application/views/scripts/tactical/components/parts/servicestatesummarybyhoststate.phtml @@ -5,7 +5,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 2, 'service_acknowledged' => 0, 'service_in_downtime' => 0) ); ?>"> - translate('CRITICAL', 'icinga.state') ?> + translatePlural('%d CRITICAL', '%d CRITICAL', $services_critical_unhandled, 'icinga.state'), $services_critical_unhandled); ?> @@ -145,7 +145,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 3, 'service_acknowledged' => 0, 'service_in_downtime' => 0) ); ?>"> - translate('UNKNOWN', 'icinga.state') ?> + translatePlural('%d UNKNOWN', '%d UNKNOWN', $services_unknown_unhandled, 'icinga.state'), $services_unknown_unhandled) ?> @@ -249,7 +249,7 @@ 'monitoring/list/services', array('host_problem' => $host_problem, 'service_state' => 99) ); ?>"> - translate('PENDING', 'icinga.state') ?> + translatePlural('%d PENDING', '%d PENDING', $services_pending, 'icinga.state'), $services_pending); ?> href('monitoring/list/hosts', array('host_state' => 1)); ?>"> - translate('%d Hosts DOWN'), $this->statusSummary->hosts_down); ?> + translatePlural('%d Host DOWN', '%d Hosts DOWN', $this->statusSummary->hosts_down), $this->statusSummary->hosts_down); ?>

statusSummary->hosts_unreachable): ?>

- translate('%d Hosts UNREACHABLE'), $this->statusSummary->hosts_unreachable); ?> + translatePlural('%d Host UNREACHABLE', '%d Hosts UNREACHABLE', $this->statusSummary->hosts_unreachable), $this->statusSummary->hosts_unreachable); ?>

From f94646eb419504da5c455b2717ad3615e1029ec3 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 8 Dec 2014 10:27:36 +0100 Subject: [PATCH 2/4] monitoring/tactical: Fix "Host and Service Checks" header --- .../views/scripts/tactical/components/hostservicechecks.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/scripts/tactical/components/hostservicechecks.phtml b/modules/monitoring/application/views/scripts/tactical/components/hostservicechecks.phtml index 52aeb5c54..64265304d 100644 --- a/modules/monitoring/application/views/scripts/tactical/components/hostservicechecks.phtml +++ b/modules/monitoring/application/views/scripts/tactical/components/hostservicechecks.phtml @@ -1,5 +1,5 @@
-

translate('Host- and Servicechecks'); ?>

+

translate('Host and Service Checks'); ?>

@@ -59,7 +59,7 @@ 'monitoring/list/services', array('service_active_checks_enabled' => 0, 'service_passive_checks_enabled' => 1) ); ?>"> - statusSummary->services_passive . ' ' . $this->translatePlural('Passive', 'Passive', $this->statusSummary->services_passive); ?> + translatePlural('%d Passive', '%d Passive', $this->statusSummary->services_passive), $this->statusSummary->services_passive); ?> From 550bb7d7d18c60f529cf8ab5b2c33775ae31fff5 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 8 Dec 2014 10:29:41 +0100 Subject: [PATCH 3/4] monitoring/tactical: Fix case of features' titles --- .../scripts/tactical/components/monitoringfeatures.phtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml b/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml index 2428e0d40..6c78fcd41 100644 --- a/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml +++ b/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml @@ -3,9 +3,9 @@
statusSummary->hosts_without_flap_detection || $this->statusSummary->services_without_flap_detection || $this->statusSummary->hosts_flapping || $this->statusSummary->services_flapping): ?> -
translate('Flap detection'); ?>
+
translate('Flap Detection'); ?>
-
translate('Flap detection'); ?>
+
translate('Flap Detection'); ?>
@@ -121,9 +121,9 @@
statusSummary->hosts_not_processing_event_handlers || $this->statusSummary->services_not_processing_event_handlers): ?> -
translate('Event handlers'); ?>
+
translate('Event Handlers'); ?>
-
translate('Event handlers'); ?>
+
translate('Event Handlers'); ?>
From de0653eaa63f602583ec2d4d7735ada7c0393fbe Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 8 Dec 2014 10:33:40 +0100 Subject: [PATCH 4/4] monitoring/tactical: Fix case of the features' links Use title capitalization for the features' links to be consitent. --- .../components/monitoringfeatures.phtml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml b/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml index 6c78fcd41..36b88b050 100644 --- a/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml +++ b/modules/monitoring/application/views/scripts/tactical/components/monitoringfeatures.phtml @@ -17,7 +17,7 @@ 'monitoring/list/hosts', array('host_flap_detection_enabled' => 0) ); ?>" class="feature-highlight"> - translatePlural('%d host disabled', '%d hosts disabled', $this->statusSummary->hosts_without_flap_detection), $this->statusSummary->hosts_without_flap_detection); ?> + translatePlural('%d Host Disabled', '%d Hosts Disabled', $this->statusSummary->hosts_without_flap_detection), $this->statusSummary->hosts_without_flap_detection); ?>
@@ -25,7 +25,7 @@ 'monitoring/list/hosts', array('host_flap_detection_enabled' => 1) ); ?>"> - translate('All hosts enabled'); ?> + translate('All Hosts Enabled'); ?> statusSummary->hosts_flapping): ?> @@ -33,7 +33,7 @@ 'monitoring/list/hosts', array('host_is_flapping' => 1) ); ?>" class="feature-highlight"> - translatePlural('%d host flapping', '%d hosts flapping', $this->statusSummary->hosts_flapping), $this->statusSummary->hosts_flapping); ?> + translatePlural('%d Host Flapping', '%d Hosts Flapping', $this->statusSummary->hosts_flapping), $this->statusSummary->hosts_flapping); ?>
@@ -45,7 +45,7 @@ 'monitoring/list/services', array('service_flap_detection_enabled' => 0) ); ?>" class="feature-highlight"> - translatePlural('%d service disabled', '%d services disabled', $this->statusSummary->services_without_flap_detection), $this->statusSummary->services_without_flap_detection); ?> + translatePlural('%d Service Disabled', '%d Services Disabled', $this->statusSummary->services_without_flap_detection), $this->statusSummary->services_without_flap_detection); ?>
@@ -53,7 +53,7 @@ 'monitoring/list/services', array('service_flap_detection_enabled' => 1) ); ?>"> - translate('All services enabled'); ?> + translate('All Services Enabled'); ?> statusSummary->services_flapping): ?> @@ -61,7 +61,7 @@ 'monitoring/list/services', array('service_is_flapping' => 1) ); ?>" class="feature-highlight"> - translatePlural('%d service flapping', '%d services flapping', $this->statusSummary->services_flapping), $this->statusSummary->services_flapping); ?> + translatePlural('%d Service Flapping', '%d Services Flapping', $this->statusSummary->services_flapping), $this->statusSummary->services_flapping); ?>
@@ -84,7 +84,7 @@ 'monitoring/list/hosts', array('host_notifications_enabled' => 0) ); ?>" class="feature-highlight"> - translatePlural('%d host disabled', '%d hosts disabled', $this->statusSummary->hosts_not_triggering_notifications), $this->statusSummary->hosts_not_triggering_notifications); ?> + translatePlural('%d Host Disabled', '%d Hosts Disabled', $this->statusSummary->hosts_not_triggering_notifications), $this->statusSummary->hosts_not_triggering_notifications); ?>
@@ -92,7 +92,7 @@ 'monitoring/list/hosts', array('host_notifications_enabled' => 1) ); ?>"> - translate('All hosts enabled'); ?> + translate('All Hosts Enabled'); ?>
@@ -104,7 +104,7 @@ 'monitoring/list/services', array('service_notifications_enabled' => 0) ); ?>" class="feature-highlight"> - translatePlural('%d service disabled', '%d services disabled', $this->statusSummary->services_not_triggering_notifications), $this->statusSummary->services_not_triggering_notifications); ?> + translatePlural('%d Service Disabled', '%d Services Disabled', $this->statusSummary->services_not_triggering_notifications), $this->statusSummary->services_not_triggering_notifications); ?>
@@ -112,7 +112,7 @@ 'monitoring/list/services', array('service_notifications_enabled' => 1) ); ?>"> - translate('All services enabled'); ?> + translate('All Services Enabled'); ?>
@@ -135,7 +135,7 @@ 'monitoring/list/hosts', array('host_event_handler_enabled' => 0) ); ?>" class="feature-highlight"> - translatePlural('%d host disabled', '%d hosts disabled', $this->statusSummary->hosts_not_processing_event_handlers), $this->statusSummary->hosts_not_processing_event_handlers); ?> + translatePlural('%d Host Disabled', '%d Hosts Disabled', $this->statusSummary->hosts_not_processing_event_handlers), $this->statusSummary->hosts_not_processing_event_handlers); ?>
@@ -143,7 +143,7 @@ 'monitoring/list/hosts', array('host_event_handler_enabled' => 1) ); ?>"> - translate('All hosts enabled'); ?> + translate('All Hosts Enabled'); ?>
@@ -155,7 +155,7 @@ 'monitoring/list/services', array('service_event_handler_enabled' => 0) ); ?>" class="feature-highlight"> - translatePlural('%d service disabled', '%d services disabled', $this->statusSummary->services_not_processing_event_handlers), $this->statusSummary->services_not_processing_event_handlers); ?> + translatePlural('%d Service Disabled', '%d Services Disabled', $this->statusSummary->services_not_processing_event_handlers), $this->statusSummary->services_not_processing_event_handlers); ?>
@@ -163,7 +163,7 @@ 'monitoring/list/services', array('service_event_handler_enabled' => 1) ); ?>"> - translate('All services enabled'); ?> + translate('All Services Enabled'); ?>