@zohodesk/i18n 1.0.0-exp.4 → 1.0.0-exp.6

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/es/utils/index.js CHANGED
@@ -243,6 +243,9 @@ export function getLocalizedValue() {
243
243
  return localizedValue || null;
244
244
  }
245
245
  export function getI18NValue(i18n) {
246
+ if (typeof i18n === 'undefined') {
247
+ return key => getFallbackText(key);
248
+ }
246
249
  return (key, values, localizedProps) => {
247
250
  const localizedValue = localizedProps ? getLocalizedValue(localizedProps) : localizedStringData[key];
248
251
  const finalKey = getMappedKey(key);
@@ -175,6 +175,9 @@ export function placeComponentForTags(i18nValue) {
175
175
  return i18nMechanismForComponents(value, value);
176
176
  }
177
177
  export function getI18NComponent(i18n) {
178
+ if (typeof i18n === 'undefined') {
179
+ return key => getFallbackText(key);
180
+ }
178
181
  return key => {
179
182
  let i18nStr = i18n[key];
180
183
  if (i18nStr === undefined) {
@@ -276,6 +276,11 @@ function getLocalizedValue() {
276
276
  return localizedValue || null;
277
277
  }
278
278
  function getI18NValue(i18n) {
279
+ if (typeof i18n === 'undefined') {
280
+ return function (key) {
281
+ return (0, _errorReporter.getFallbackText)(key);
282
+ };
283
+ }
279
284
  return function (key, values, localizedProps) {
280
285
  var localizedValue = localizedProps ? getLocalizedValue(localizedProps) : localizedStringData[key];
281
286
  var finalKey = getMappedKey(key);
@@ -198,6 +198,11 @@ function placeComponentForTags(i18nValue) {
198
198
  return i18nMechanismForComponents(value, value);
199
199
  }
200
200
  function getI18NComponent(i18n) {
201
+ if (typeof i18n === 'undefined') {
202
+ return function (key) {
203
+ return (0, _errorReporter.getFallbackText)(key);
204
+ };
205
+ }
201
206
  return function (key) {
202
207
  var i18nStr = i18n[key];
203
208
  if (i18nStr === undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/i18n",
3
- "version": "1.0.0-exp.4",
3
+ "version": "1.0.0-exp.6",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "jsnext:main": "es/index.js",
@@ -293,6 +293,9 @@ export function getLocalizedValue({
293
293
  return localizedValue || null
294
294
  }
295
295
  export function getI18NValue(i18n) {
296
+ if (typeof i18n === 'undefined') {
297
+ return (key) => getFallbackText(key);
298
+ }
296
299
  return (key, values, localizedProps) => {
297
300
  const localizedValue = localizedProps
298
301
  ? getLocalizedValue(localizedProps)
@@ -180,6 +180,9 @@ export function placeComponentForTags(i18nValue) {
180
180
  }
181
181
 
182
182
  export function getI18NComponent(i18n) {
183
+ if (typeof i18n === 'undefined') {
184
+ return (key) => getFallbackText(key);
185
+ }
183
186
  return (key) => {
184
187
  let i18nStr = i18n[key];
185
188
  if (i18nStr === undefined) {