Skip to content
This repository has been archived by the owner on Sep 3, 2019. It is now read-only.

Commit

Permalink
Fix for issue rubenv#348: Getstring must not interpolate, interpolati…
Browse files Browse the repository at this point in the history
…onContext is now a real subscope
  • Loading branch information
anx-ckreuzberger committed Aug 2, 2019
1 parent a999749 commit 4b08e12
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion dist/angular-gettext.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ angular.module('gettext').factory('gettextCatalog', ["gettextPlurals", "gettextF
string = this.getStringFormFor(this.currentLanguage, string, 1, context) ||
this.getStringFormFor(fallbackLanguage, string, 1, context) ||
prefixDebug(string);
string = scope ? $interpolate(string)(scope) : string;
return addTranslatedMarkers(string);
},

Expand Down
1 change: 0 additions & 1 deletion src/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ angular.module('gettext').factory('gettextCatalog', function (gettextPlurals, ge
string = this.getStringFormFor(this.currentLanguage, string, 1, context) ||
this.getStringFormFor(fallbackLanguage, string, 1, context) ||
prefixDebug(string);
string = scope ? $interpolate(string)(scope) : string;
return addTranslatedMarkers(string);
},

Expand Down
8 changes: 4 additions & 4 deletions test/unit/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,20 @@ describe("Catalog", function () {
assert.equal(catalog.getPlural(2, "Bird", "Birds"), "[MISSING]: Birds");
});

it("Can return an interpolated string", function () {
it("Can not interpolate strings", function () {
var strings = { "Hello {{name}}!": "Hallo {{name}}!" };
assert.deepEqual(catalog.strings, {});
catalog.setCurrentLanguage("nl");
catalog.setStrings("nl", strings);
assert.equal(catalog.getString("Hello {{name}}!", { name: "Andrew" }), "Hallo Andrew!");
assert.equal(catalog.getString("Hello {{name}}!", { name: "Andrew" }), "Hallo {{name}}!");
});

it("Can return a pure interpolated string", function () {
it("Can not interpolate a pure string", function () {
var strings = { "{{name}}": "{{name}}" };
assert.deepEqual(catalog.strings, {});
catalog.setCurrentLanguage("nl");
catalog.setStrings("nl", strings);
assert.equal(catalog.getString("{{name}}", { name: "Andrew" }), "Andrew");
assert.equal(catalog.getString("{{name}}", { name: "Andrew" }), "{{name}}");
});

it("Can return an interpolated plural string", function () {
Expand Down

0 comments on commit 4b08e12

Please sign in to comment.