@digitaldefiance/i18n-lib 1.0.30 → 1.0.31

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.
@@ -107,17 +107,19 @@ class I18nEngine {
107
107
  const fallback = fallbackLanguage ?? this.config.defaultLanguage;
108
108
  try {
109
109
  const stringValue = this.getString(lang, key);
110
- return (0, utils_1.isTemplate)(key)
110
+ const result = (0, utils_1.isTemplate)(key)
111
111
  ? (0, utils_1.replaceVariables)(stringValue, vars, this.config.constants)
112
112
  : stringValue;
113
+ return typeof result === 'string' ? result : String(result);
113
114
  }
114
115
  catch {
115
116
  if (lang !== fallback) {
116
117
  try {
117
118
  const stringValue = this.getString(fallback, key);
118
- return (0, utils_1.isTemplate)(key)
119
+ const result = (0, utils_1.isTemplate)(key)
119
120
  ? (0, utils_1.replaceVariables)(stringValue, vars, this.config.constants)
120
121
  : stringValue;
122
+ return typeof result === 'string' ? result : String(result);
121
123
  }
122
124
  catch {
123
125
  return String(key);
@@ -159,9 +161,10 @@ class I18nEngine {
159
161
  if (!strings?.[key])
160
162
  return String(key);
161
163
  const stringValue = strings[key];
162
- return (0, utils_1.isTemplate)(key)
164
+ const result = (0, utils_1.isTemplate)(key)
163
165
  ? (0, utils_1.replaceVariables)(stringValue, vars, this.config.constants)
164
166
  : stringValue;
167
+ return typeof result === 'string' ? result : String(result);
165
168
  }
166
169
  catch {
167
170
  return String(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitaldefiance/i18n-lib",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Generic i18n library with enum translation support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",