diff options
author | Phil Hughes <me@iamphill.com> | 2017-04-19 18:53:06 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-04-19 18:53:06 +0300 |
commit | 7d16537cac7eb808d8d18cd0b89475db4e4eeaaa (patch) | |
tree | 69ad2b7cc10d5626d5ed4fef6ef2017b26152676 /app/assets/javascripts/vue_shared/translate.js | |
parent | a3506a228723d7e31fb37580dcd3b30245436f22 (diff) |
Created a plural filter
Added tests for the filter
[ci skip]
Diffstat (limited to 'app/assets/javascripts/vue_shared/translate.js')
-rw-r--r-- | app/assets/javascripts/vue_shared/translate.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/assets/javascripts/vue_shared/translate.js b/app/assets/javascripts/vue_shared/translate.js index 88b7c0bb954..072828b310e 100644 --- a/app/assets/javascripts/vue_shared/translate.js +++ b/app/assets/javascripts/vue_shared/translate.js @@ -3,6 +3,9 @@ import locale from '../locale'; export default (Vue) => { Vue.filter('translate', text => locale.gettext(text)); + Vue.filter('translate-plural', (text, pluralText, count) => + locale.ngettext(text, pluralText, count).replace(/%d/g, count)); + Vue.directive('translate', { bind(el) { const $el = el; |