@designcrowd/library.brand-page 5.10.39 → 5.10.40

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@designcrowd/library.brand-page",
3
3
  "description": "A collection of Maker/Designer applications",
4
- "version": "5.10.39",
4
+ "version": "5.10.40",
5
5
  "author": "Design.com Eng",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -2,6 +2,8 @@ import i18next from 'i18next';
2
2
  import { setSharedLibLocaleAsync } from '@designcrowd/fe-shared-lib';
3
3
  import { getCurrentInstance } from 'vue';
4
4
 
5
+ const nameSpace = 'bp';
6
+
5
7
  const fallbackLocale = 'en-US';
6
8
 
7
9
  export type LocaleTypes = 'de-DE' | 'en-US' | 'fr-FR' | 'es-ES' | 'pt-PT';
@@ -57,13 +59,23 @@ const setLocaleAsync = async (locale?: LocaleTypes) => {
57
59
  });
58
60
  }
59
61
 
60
- await i18.addResourceBundle(localeToUse, 'bp', { ...languageFile });
62
+ await i18.addResourceBundle(localeToUse, nameSpace, { ...languageFile });
61
63
 
62
64
  await setSharedLibLocaleAsync(localeToUse);
63
65
  };
64
66
 
65
- const tr = (key: string, valuesToInterpolate = {}, nameSpace = 'bp') => {
66
- const translated = getI18NextInstance().t(key, {
67
+ const tr = (
68
+ key: string,
69
+ valuesToInterpolate = {},
70
+ returnEmptyIfNotExist = false,
71
+ ) => {
72
+ const instance = getI18NextInstance();
73
+
74
+ if (returnEmptyIfNotExist && !instance.exists(key, { ns: nameSpace })) {
75
+ return '';
76
+ }
77
+
78
+ const translated = instance.t(key, {
67
79
  ns: nameSpace,
68
80
  ...valuesToInterpolate,
69
81
  });
@@ -136,7 +148,7 @@ const publishBrandPageModalWithStateTr = (key, valuesToInterpolate = {}) =>
136
148
  tr(`publishBrandPageModalWithState.${key}`, valuesToInterpolate);
137
149
  const existingDomainModalTr = (key) => tr(`existingDomainModal.${key}`);
138
150
  const sensitiveContentModalTr = (key, valuesToInterpolate = {}) =>
139
- tr(`sensitiveContentModal.${key}`, valuesToInterpolate);
151
+ tr(`sensitiveContentModal.${key}`, valuesToInterpolate, true);
140
152
  const quickLinkBarTr = (key) => tr(`quickLinkBar.${key}`);
141
153
 
142
154
  export {