Skip to content

Commit

Permalink
Make output strings translatable
Browse files Browse the repository at this point in the history
Switch away from hard coded English.
  • Loading branch information
Dylan Wagstaff committed May 30, 2018
1 parent 7efa85c commit af35d4a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions lang/en.yml
Original file line number Diff line number Diff line change
@@ -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 <strong>{count}</strong> of your modules. Review and updating is recommended.'
2 changes: 1 addition & 1 deletion src/Extensions/PackageSecruityExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}

Expand Down
9 changes: 7 additions & 2 deletions templates/SecurityAlertSummary.ss
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
<p>
<strong>Security alert</strong><br />
<% if Count > 1 %>Notices have<% else %>A notice has<% end_if %> been issued for <strong>$Count</strong> of your modules. Review and updating is recommended.
<strong><%t SecuirtyAlertSummary.TITLE "Security alert" %></strong><br />
<% 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 <strong>{count}</strong> of your modules. Review and updating is recommended." count=$Count %>
</p>

0 comments on commit af35d4a

Please sign in to comment.