webpack-easyi18n 0.3.7 → 0.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +7 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webpack-easyi18n",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Go from gettext catalog (.po files) to embeded localization in your Webpack bundles",
5
5
  "engines": {
6
6
  "node": ">=4.3.0 <5.0.0 || >=5.10"
package/src/index.js CHANGED
@@ -15,6 +15,12 @@ class EasyI18nPlugin {
15
15
  includeUrls: null,
16
16
  };
17
17
 
18
+ static escapeSpeechMarks = (string) => {
19
+ return string
20
+ .replace(/'/g, '\\\'')
21
+ .replace(/"/g, '\\"');
22
+ }
23
+
18
24
  constructor(locale, options = {}) {
19
25
  this.locale = locale;
20
26
  this.options = {
@@ -127,7 +133,7 @@ class EasyI18nPlugin {
127
133
  });
128
134
  }
129
135
 
130
- return replacement;
136
+ return EasyI18nPlugin.escapeSpeechMarks(replacement);
131
137
  });
132
138
 
133
139
  compilation.updateAsset(filename, new SourceMapSource(