summaryrefslogtreecommitdiff
path: root/engines/support/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'engines/support/app/helpers')
-rw-r--r--engines/support/app/helpers/ticket_i18n_helper.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/engines/support/app/helpers/ticket_i18n_helper.rb b/engines/support/app/helpers/ticket_i18n_helper.rb
new file mode 100644
index 0000000..61b4cf2
--- /dev/null
+++ b/engines/support/app/helpers/ticket_i18n_helper.rb
@@ -0,0 +1,20 @@
+module TicketI18nHelper
+
+ #
+ # outputs translations for all the possible translated strings.
+ # used in emails, sense we don't know the locale of the recipient.
+ #
+ def t_all_available(key)
+ default = I18n.t(key, locale: I18n.default_locale)
+ result = []
+ result << "[#{I18n.default_locale}] #{default}"
+ I18n.available_locales.each do |locale|
+ text = I18n.t(key, locale: locale, default: default)
+ if text != default
+ result << "[#{locale}] #{text}"
+ end
+ end
+ result.join("\n")
+ end
+
+end