From af35d4af7b55070e08730791cce10a4a4c6859c0 Mon Sep 17 00:00:00 2001 From: Dylan Wagstaff Date: Wed, 30 May 2018 17:20:33 +1200 Subject: [PATCH] Make output strings translatable Switch away from hard coded English. --- .editorconfig | 3 --- lang/en.yml | 8 ++++++++ src/Extensions/PackageSecruityExtension.php | 2 +- templates/SecurityAlertSummary.ss | 9 +++++++-- 4 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 lang/en.yml diff --git a/.editorconfig b/.editorconfig index 77cadaa..0a8a30b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,9 +10,6 @@ indent_style = space insert_final_newline = true trim_trailing_whitespace = true -[*.md] -trim_trailing_whitespace = false - [*{.yml,.js}] indent_size = 2 indent_style = space diff --git a/lang/en.yml b/lang/en.yml new file mode 100644 index 0000000..e48f454 --- /dev/null +++ b/lang/en.yml @@ -0,0 +1,8 @@ +en: + PackageSecurityExtension: + BADGE_SECURITY: 'RISK: Security' + SecuirtyAlertSummary: + TITLE: 'Security alert' + NOTICE_HAS: 'A notice has' + NOTICES_HAVE: 'Notices have' + NUMBER_REVIEW: 'been issued for {count} of your modules. Review and updating is recommended.' diff --git a/src/Extensions/PackageSecruityExtension.php b/src/Extensions/PackageSecruityExtension.php index 8d801f1..f3abfec 100644 --- a/src/Extensions/PackageSecruityExtension.php +++ b/src/Extensions/PackageSecruityExtension.php @@ -40,7 +40,7 @@ public function listAlerts() public function updateBadges(&$badges) { if ($this->owner->SecurityAlerts()->exists()) { - $badges['RISK: Security'] = 'warning security-alerts__toggler'; + $badges[_t(__CLASS__ . '.BADGE_SECURITY', 'RISK: Security')] = 'warning security-alerts__toggler'; } } diff --git a/templates/SecurityAlertSummary.ss b/templates/SecurityAlertSummary.ss index 5c0d567..f3d4e8e 100644 --- a/templates/SecurityAlertSummary.ss +++ b/templates/SecurityAlertSummary.ss @@ -1,4 +1,9 @@

- Security alert
- <% if Count > 1 %>Notices have<% else %>A notice has<% end_if %> been issued for $Count of your modules. Review and updating is recommended. + <%t SecuirtyAlertSummary.TITLE "Security alert" %>
+ <% if Count > 1 %> + <%t SecuirtyAlertSummary.NOTICES_HAVE "Notices have" %> + <% else %> + <%t SecuirtyAlertSummary.NOTICE_HAS "A notice has" %> + <% end_if %> + <%t SecuirtyAlertSummary.NUMBER_REVIEW "been issued for {count} of your modules. Review and updating is recommended." count=$Count %>

\ No newline at end of file