@sv443-network/userutils 9.4.3 → 9.4.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @sv443-network/userutils
2
2
 
3
+ ## 9.4.4
4
+
5
+ ### Patch Changes
6
+
7
+ - e8846b5: Fixed infinite recursion in `translate()` when using `setFallbackLanguage()`
8
+ - 59011c1: Removed package.json engines field
9
+
3
10
  ## 9.4.3
4
11
 
5
12
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1859,7 +1859,7 @@ function translate(language, key, ...trArgs) {
1859
1859
  language = fallbackLang != null ? fallbackLang : "";
1860
1860
  const trObj = trans[language];
1861
1861
  if (typeof language !== "string" || language.length === 0 || typeof trObj !== "object" || trObj === null)
1862
- return fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1862
+ return fallbackLang && language !== fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1863
1863
  const transformTrVal = (trKey, trValue) => {
1864
1864
  const tfs = valTransforms.filter(({ regex }) => new RegExp(regex).test(String(trValue)));
1865
1865
  if (tfs.length === 0)
@@ -1899,7 +1899,7 @@ function translate(language, key, ...trArgs) {
1899
1899
  value = trObj == null ? undefined : trObj[key];
1900
1900
  if (typeof value === "string")
1901
1901
  return transformTrVal(key, value);
1902
- return fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1902
+ return fallbackLang && language !== fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1903
1903
  }
1904
1904
  function trFor(language, key, ...args) {
1905
1905
  const txt = translate(language, key, ...args);
@@ -8,7 +8,7 @@
8
8
  // ==UserLibrary==
9
9
  // @name UserUtils
10
10
  // @description General purpose DOM/GreaseMonkey library that allows you to register listeners for when CSS selectors exist, intercept events, create persistent & synchronous data stores, modify the DOM more easily and much more
11
- // @version 9.4.3
11
+ // @version 9.4.4
12
12
  // @license MIT
13
13
  // @copyright Sv443 (https://github.com/Sv443)
14
14
 
@@ -1897,7 +1897,7 @@ Has: ${checksum}`);
1897
1897
  language = fallbackLang != null ? fallbackLang : "";
1898
1898
  const trObj = trans[language];
1899
1899
  if (typeof language !== "string" || language.length === 0 || typeof trObj !== "object" || trObj === null)
1900
- return fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1900
+ return fallbackLang && language !== fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1901
1901
  const transformTrVal = (trKey, trValue) => {
1902
1902
  const tfs = valTransforms.filter(({ regex }) => new RegExp(regex).test(String(trValue)));
1903
1903
  if (tfs.length === 0)
@@ -1937,7 +1937,7 @@ Has: ${checksum}`);
1937
1937
  value = trObj == null ? undefined : trObj[key];
1938
1938
  if (typeof value === "string")
1939
1939
  return transformTrVal(key, value);
1940
- return fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1940
+ return fallbackLang && language !== fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1941
1941
  }
1942
1942
  function trFor(language, key, ...args) {
1943
1943
  const txt = translate(language, key, ...args);
package/dist/index.js CHANGED
@@ -1857,7 +1857,7 @@ function translate(language, key, ...trArgs) {
1857
1857
  language = fallbackLang != null ? fallbackLang : "";
1858
1858
  const trObj = trans[language];
1859
1859
  if (typeof language !== "string" || language.length === 0 || typeof trObj !== "object" || trObj === null)
1860
- return fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1860
+ return fallbackLang && language !== fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1861
1861
  const transformTrVal = (trKey, trValue) => {
1862
1862
  const tfs = valTransforms.filter(({ regex }) => new RegExp(regex).test(String(trValue)));
1863
1863
  if (tfs.length === 0)
@@ -1897,7 +1897,7 @@ function translate(language, key, ...trArgs) {
1897
1897
  value = trObj == null ? undefined : trObj[key];
1898
1898
  if (typeof value === "string")
1899
1899
  return transformTrVal(key, value);
1900
- return fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1900
+ return fallbackLang && language !== fallbackLang ? translate(fallbackLang, key, ...trArgs) : key;
1901
1901
  }
1902
1902
  function trFor(language, key, ...args) {
1903
1903
  const txt = translate(language, key, ...args);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sv443-network/userutils",
3
3
  "libName": "UserUtils",
4
- "version": "9.4.3",
4
+ "version": "9.4.4",
5
5
  "description": "General purpose DOM/GreaseMonkey library that allows you to register listeners for when CSS selectors exist, intercept events, create persistent & synchronous data stores, modify the DOM more easily and much more",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -14,11 +14,6 @@
14
14
  "import": "./dist/index.js"
15
15
  }
16
16
  },
17
- "engines": {
18
- "pnpm": ">=9",
19
- "npm": "please-use-pnpm",
20
- "yarn": "please-use-pnpm"
21
- },
22
17
  "type": "module",
23
18
  "repository": {
24
19
  "type": "git",