diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-01-18 13:22:28 +1100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-04-09 19:14:43 +0100 |
commit | 0196035acd1d7d113a7130263fda23f096306c84 (patch) | |
tree | a6f8a662cf88af5ebac78a6acff0f2a3aa5b15ea /lib | |
parent | a003563920333598c129c4b47410e621eb24a4eb (diff) |
Override n_ to add interpolation
Diffstat (limited to 'lib')
-rw-r--r-- | lib/i18n_fixes.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/i18n_fixes.rb b/lib/i18n_fixes.rb index a85faddcb..82d1b2c3a 100644 --- a/lib/i18n_fixes.rb +++ b/lib/i18n_fixes.rb @@ -14,6 +14,17 @@ def _(key, options = {}) gettext_interpolate(translation, options) end +def n_(*keys) + # The last parameter should be the values to do the interpolation with + if keys.count > 3 + options = keys.pop + else + options = {} + end + translation = FastGettext.n_(*keys).html_safe + gettext_interpolate(translation, options) +end + MATCH = /\{\{([^\}]+)\}\}/ def gettext_interpolate(string, values) |