i18n-keyless-react 1.5.1 → 1.5.3

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/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-react",
3
3
  "private": false,
4
- "version": "1.5.1",
4
+ "version": "1.5.3",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
package/dist/store.js CHANGED
@@ -101,6 +101,11 @@ export const useI18nKeyless = create((set, get) => ({
101
101
  }
102
102
  },
103
103
  getTranslation: (text) => {
104
+ const currentLanguage = get().currentLanguage;
105
+ const config = get().config;
106
+ if (currentLanguage === config.languages.primary) {
107
+ return text;
108
+ }
104
109
  const translation = get().translations[text];
105
110
  if (!translation) {
106
111
  get().translateKey(text);
@@ -121,6 +126,9 @@ export const useI18nKeyless = create((set, get) => ({
121
126
  // console.error("i18n-keyless: Key length exceeds 280 characters limit:", key);
122
127
  // return;
123
128
  // }
129
+ if (!key) {
130
+ return;
131
+ }
124
132
  const translation = get().translations[key];
125
133
  if (translation) {
126
134
  return;
@@ -239,9 +247,9 @@ export async function fetchAllTranslations(targetLanguage) {
239
247
  console.error("i18n-keyless: No config found");
240
248
  return;
241
249
  }
242
- if (config.languages.primary === targetLanguage) {
243
- return;
244
- }
250
+ // if (config.languages.primary === targetLanguage) {
251
+ // return;
252
+ // }
245
253
  try {
246
254
  const response = config.getAllTranslations
247
255
  ? await config.getAllTranslations()
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "i18n-keyless-react",
3
3
  "private": false,
4
- "version": "1.5.1",
4
+ "version": "1.5.3",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",