@urso/core 0.4.40 → 0.4.41

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.4.40",
3
+ "version": "0.4.41",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -6,6 +6,8 @@ class ModulesI18nController {
6
6
  * get text by localeId
7
7
  * @param {String} localeId
8
8
  * @param {Object} [localeVariables] - variables for locale string
9
+ *
10
+ * @example get('Some333 ${bet} " `test ${multi} text localized', {bet:12,multi:13})
9
11
  */
10
12
  get(localeId, localeVariables = {}) {
11
13
  if (this.#vocabulary && this.#vocabulary[localeId]) {
@@ -66,12 +68,11 @@ class ModulesI18nController {
66
68
  }
67
69
 
68
70
  _interpolate(string, params) {
69
- const names = Object.keys(params);
70
- const vals = Object.values(params);
71
- const encodedString = encodeURIComponent(string);
72
- const resultEncodedString = new Function(...names, `return \`${encodedString}\`;`)(...vals);
71
+ for (const [key, value] of Object.entries(params)) {
72
+ string = Urso.helper.stringReplace('${' + key + '}', value, string);
73
+ }
73
74
 
74
- return decodeURIComponent(resultEncodedString);
75
+ return string
75
76
  }
76
77
  }
77
78