i18n-smell-detector 0.4.0 → 0.4.2

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/README.md CHANGED
@@ -4,10 +4,12 @@
4
4
  [![CI](https://github.com/xue-moe/i18n-smell-detector/actions/workflows/ci.yml/badge.svg)](https://github.com/xue-moe/i18n-smell-detector/actions/workflows/ci.yml)
5
5
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
6
6
 
7
- Find locale values copied from the base locale.
7
+ Find localization issues that key coverage checks miss.
8
8
 
9
9
  `i18n-smell-detector` checks localization files for keys whose translated value is identical to the base locale. It can also scan Vue templates for hardcoded user-visible strings.
10
10
 
11
+ Current scope: `check-hardcoded` scans Vue templates only; JavaScript, TypeScript, and JSX strings are not scanned yet. Text classification is rule-based and conservative, so projects with many proper nouns, product codes, or non-English copy should start with `--fail-on none` and tune allowlists before enforcing CI.
12
+
11
13
  ## Features
12
14
 
13
15
  - Detect values that are identical to the base locale
@@ -70,7 +72,7 @@ For a new project, it is often easier to start in reporting mode while tuning al
70
72
  npx i18n-smell-detector check --config i18n-smell.config.mjs --fail-on none
71
73
  ```
72
74
 
73
- ### GitHub Actions example
75
+ ### CI report artifact
74
76
 
75
77
  Add a workflow such as `.github/workflows/i18n-smell.yml`:
76
78
 
@@ -109,15 +111,6 @@ jobs:
109
111
  path: reports/i18n-smell.md
110
112
  ```
111
113
 
112
- For this repository, the local smoke commands are:
113
-
114
- ```bash
115
- npm test
116
- npm run check
117
- npm run example:basic
118
- node bin/i18n-smell-detector.js --help
119
- ```
120
-
121
114
  ## Configuration
122
115
 
123
116
  Create `i18n-smell.config.mjs`:
@@ -314,7 +307,7 @@ JSON output includes source locations:
314
307
  }
315
308
  ```
316
309
 
317
- ## Running All Checks
310
+ ## Running all checks
318
311
 
319
312
  Use `check` to run every enabled check in one command:
320
313
 
@@ -355,7 +348,7 @@ Combined JSON output groups counts by check:
355
348
  }
356
349
  ```
357
350
 
358
- ## Writing Reports
351
+ ## Writing reports
359
352
 
360
353
  Use `--output` to write the full report to a file. The CLI prints a short summary to stdout after writing.
361
354
 
@@ -366,7 +359,7 @@ npx i18n-smell-detector check --format json --output reports/i18n-report.json
366
359
 
367
360
  Markdown output for `check` includes a summary table and one section per check, which makes it suitable for CI artifacts.
368
361
 
369
- ## Gradual Adoption
362
+ ## Gradual adoption
370
363
 
371
364
  Use a baseline to ignore existing findings while still failing CI for new ones:
372
365
 
@@ -448,7 +441,7 @@ Useful tuning patterns:
448
441
 
449
442
  ## Limitations
450
443
 
451
- `check-hardcoded` currently scans Vue templates only. JavaScript, TypeScript, and JSX string detection are not included yet.
444
+ `check-hardcoded` currently scans Vue templates only. JavaScript, TypeScript, and JSX string detection are not included yet. Classification uses heuristic rules rather than full language detection.
452
445
 
453
446
  ## Notes
454
447
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18n-smell-detector",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Find locale values copied from the base locale.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,6 +25,10 @@
25
25
  "check:identical": "node ./bin/i18n-smell-detector.js check-identical --config ./examples/vue-vite/i18n-smell.config.mjs --fail-on none",
26
26
  "check:hardcoded": "node ./bin/i18n-smell-detector.js check-hardcoded --config ./examples/vue-vite/i18n-smell.config.mjs --fail-on none",
27
27
  "example:basic": "node ./bin/i18n-smell-detector.js check --config ./examples/basic/i18n-smell.config.mjs --fail-on none",
28
+ "audit": "npm audit --audit-level=moderate",
29
+ "check:package": "node ./scripts/check-package.js",
30
+ "release": "semantic-release",
31
+ "release:dry-run": "semantic-release --dry-run",
28
32
  "test": "node --test"
29
33
  },
30
34
  "keywords": [
@@ -42,5 +46,10 @@
42
46
  "@vue/compiler-dom": "^3.5.39",
43
47
  "@vue/compiler-sfc": "^3.5.39",
44
48
  "fast-glob": "^3.3.3"
49
+ },
50
+ "devDependencies": {
51
+ "@semantic-release/changelog": "^6.0.3",
52
+ "@semantic-release/git": "^10.0.1",
53
+ "semantic-release": "^25.0.5"
45
54
  }
46
55
  }
@@ -1,7 +1,7 @@
1
1
  import { summarizeIssues } from './summary.js';
2
2
 
3
3
  function escapeCell(value) {
4
- return String(value).replace(/\|/g, '\\|').replace(/\n/g, '<br>');
4
+ return String(value).replace(/\\/g, '\\\\').replace(/\|/g, '\\|').replace(/\n/g, '<br>');
5
5
  }
6
6
 
7
7
  export function renderMarkdownReport(issues, options) {
@@ -20,7 +20,7 @@ function isNonUserFacing(value) {
20
20
  }
21
21
 
22
22
  function latinWords(value) {
23
- return value.match(/[A-Za-z][A-Za-z']*/g) || [];
23
+ return value.match(/[\p{L}\p{M}][\p{L}\p{M}']*/gu) || [];
24
24
  }
25
25
 
26
26
  function isShortCommonLabel(value) {
@@ -32,7 +32,7 @@ function isPlaceholderOnly(value, patterns) {
32
32
  }
33
33
 
34
34
  function getLatinWords(value) {
35
- return value.match(/[A-Za-z][A-Za-z']*/g) || [];
35
+ return value.match(/[\p{L}\p{M}][\p{L}\p{M}']*/gu) || [];
36
36
  }
37
37
 
38
38
  function languageFamily(locale) {