Permalink
Browse files

fix issue with format containing formatSeparator for interpolation fo…

…rmatting
  • Loading branch information...
1 parent 51edd92 commit 088eef0f17d225048cb8c1df617b48df86e4fc20 @jamuhl jamuhl committed Jul 14, 2016
Showing with 9 additions and 8 deletions.
  1. +1 −1 .travis.yml
  2. +3 −0 CHANGELOG.md
  3. +2 −3 i18next.js
  4. +1 −1 i18next.min.js
  5. +2 −3 src/Interpolator.js
View
@@ -1,6 +1,6 @@
language: node_js
node_js:
- - "4.1"
+ - "6.2"
before_script:
- npm install -g gulp
- npm install -g karma
View
@@ -1,3 +1,6 @@
+### 3.4.1
+- fix issue with format containing formatSeparator for interpolation formatting
+
### 3.4.0
- adds formatting 'format this: {{var, formatRule}}' having a function on options.interpolation.format: function(value, format, lng) { return value } like suggested here [#774](https://github.com/i18next/i18next/issues/774)
View
@@ -1228,9 +1228,8 @@
if (key.indexOf(_this.formatSeparator) < 0) return getPath(data, key);
var p = key.split(_this.formatSeparator);
-
- var k = p[0].trim();
- var f = p[1].trim();
+ var k = p.shift().trim();
+ var f = p.join(_this.formatSeparator).trim();
return _this.format(getPath(data, k), f, lng);
};
View
Oops, something went wrong.
View
@@ -55,9 +55,8 @@ class Interpolator {
if (key.indexOf(this.formatSeparator) < 0) return utils.getPath(data, key);
const p = key.split(this.formatSeparator);
-
- const k = p[0].trim();
- const f = p[1].trim();
+ const k = p.shift().trim();
+ const f = p.join(this.formatSeparator).trim();
return this.format(utils.getPath(data, k), f, lng);
}

0 comments on commit 088eef0

Please sign in to comment.