@uxf/scripts 10.0.0-beta.80 → 10.7.0

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/scripts",
3
- "version": "10.0.0-beta.80",
3
+ "version": "10.7.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,5 +1,5 @@
1
1
  function findTFunctionNamespaces(pageContent) {
2
- const regex = /\bt\("([a-zA-Z0-9\-]+):([a-zA-Z0-9\-\.]+)"/g;
2
+ const regex = /\bt\("([a-zA-Z0-9\-_]+):([a-zA-Z0-9\-_\.]+)"/g;
3
3
  const matches = pageContent.matchAll(regex);
4
4
  const namespaces = new Set();
5
5
 
@@ -6,6 +6,7 @@ const content = `
6
6
  {t("basic:title")}
7
7
  {t("basic-dash:title-dash")}
8
8
  {t("basicCamel:titleCamel")}
9
+ {t("basic_underscore:title_underscore")}
9
10
  </div>
10
11
  <div title={
11
12
  condition
@@ -24,6 +25,7 @@ describe("find namespaces in t functions", function () {
24
25
  "basic",
25
26
  "basic-dash",
26
27
  "basicCamel",
28
+ "basic_underscore",
27
29
  "multiline-with-parameters",
28
30
  "with-parameters",
29
31
  "in-translation-parameter",
@@ -1,5 +1,5 @@
1
1
  function findTransComponentNamespaces(pageContent) {
2
- const regex = /<Trans[^>]*?i18nKey="([a-zA-Z0-9\-]+):([a-zA-Z0-9\-\.]+)"/g;
2
+ const regex = /<Trans[^>]*?i18nKey="([a-zA-Z0-9\-_]+):([a-zA-Z0-9\-_\.]+)"/g;
3
3
  const matches = pageContent.matchAll(regex);
4
4
  const namespaces = new Set();
5
5
 
@@ -5,11 +5,17 @@ const content = `
5
5
  <Trans i18nKey="basic:title" />
6
6
  <Trans i18nKey="basic-dash:title-dash" />
7
7
  <Trans i18nKey="basicCamel:titleCamel" />
8
+ <Trans i18nKey="basic_underscore:title_underscore" />
8
9
  </div>
9
10
  `;
10
11
 
11
12
  describe("find namespaces in trans component", function () {
12
13
  it("should find namespaces", function () {
13
- expect(findTransComponentNamespaces(content)).toStrictEqual(["basic", "basic-dash", "basicCamel"]);
14
+ expect(findTransComponentNamespaces(content)).toStrictEqual([
15
+ "basic",
16
+ "basic-dash",
17
+ "basicCamel",
18
+ "basic_underscore",
19
+ ]);
14
20
  });
15
21
  });