@urbicon-ui/i18n 8.17.0 → 8.19.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.
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* that was never routed through i18n. Heuristic and therefore ADVISORY by default
|
|
4
4
|
* (the CLI gates it only on opt-in): it flags plain markup text and a small set of
|
|
5
5
|
* human-readable attributes (`aria-label`, `title`, `placeholder`, `alt`), skips
|
|
6
|
-
* code-shaped strings, and never looks inside
|
|
7
|
-
* Text/Attribute AST nodes) or a `<T>`
|
|
6
|
+
* code-shaped strings and key chords (`⌘ K`), and never looks inside
|
|
7
|
+
* `<script>`/`<style>` (those hold no Text/Attribute AST nodes) or a `<T>`
|
|
8
|
+
* component (already translated).
|
|
8
9
|
*/
|
|
9
10
|
export interface HardcodedFinding {
|
|
10
11
|
file: string;
|
|
@@ -3,13 +3,18 @@
|
|
|
3
3
|
* that was never routed through i18n. Heuristic and therefore ADVISORY by default
|
|
4
4
|
* (the CLI gates it only on opt-in): it flags plain markup text and a small set of
|
|
5
5
|
* human-readable attributes (`aria-label`, `title`, `placeholder`, `alt`), skips
|
|
6
|
-
* code-shaped strings, and never looks inside
|
|
7
|
-
* Text/Attribute AST nodes) or a `<T>`
|
|
6
|
+
* code-shaped strings and key chords (`⌘ K`), and never looks inside
|
|
7
|
+
* `<script>`/`<style>` (those hold no Text/Attribute AST nodes) or a `<T>`
|
|
8
|
+
* component (already translated).
|
|
8
9
|
*/
|
|
9
10
|
import { makeGlobMatcher } from '../glob.js';
|
|
10
11
|
import { makeContextAt, makeLineAt } from './recognize.js';
|
|
11
12
|
import { asNodes, asString, loadParse, walkAst } from './svelte-ast.js';
|
|
12
13
|
const DEFAULT_ATTRIBUTES = ['aria-label', 'title', 'placeholder', 'alt'];
|
|
14
|
+
// Keyboard glyphs live in the Arrows, Miscellaneous Technical and Control Pictures
|
|
15
|
+
// blocks; uppercase copy carrying one (`NEXT →`, `⌘ ENTER`) passes the lowercase gate
|
|
16
|
+
// too — accepted, because source copy keeps its lowercase and uppercasing is CSS.
|
|
17
|
+
const KEY_GLYPH = /[←-⇿⌀-⏿␀-]/;
|
|
13
18
|
/** Does a trimmed string read like human UI copy rather than code/identifiers/data? */
|
|
14
19
|
function looksLikeCopy(text, min, max) {
|
|
15
20
|
if (text.length < min || text.length > max)
|
|
@@ -30,6 +35,8 @@ function looksLikeCopy(text, min, max) {
|
|
|
30
35
|
return false; // numbers / dates / separators
|
|
31
36
|
if (/[{}<>=]/.test(text))
|
|
32
37
|
return false; // markup/code fragments
|
|
38
|
+
if (!/[a-z]/.test(text) && KEY_GLYPH.test(text))
|
|
39
|
+
return false; // key chord (⌘ K)
|
|
33
40
|
return true;
|
|
34
41
|
}
|
|
35
42
|
export async function findHardcodedStrings(code, file, options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urbicon-ui/i18n",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.19.0",
|
|
4
4
|
"description": "Runes-based localization for Svelte 5 apps and the Urbicon UI design system",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"@sveltejs/package": "^2.5.8",
|
|
25
25
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
26
26
|
"@types/node": "^26.4.0",
|
|
27
|
-
"@urbicon-ui/shared-types": "8.17.0",
|
|
28
27
|
"prettier": "^3.9.6",
|
|
29
28
|
"prettier-plugin-svelte": "^4.1.1",
|
|
30
29
|
"prettier-plugin-tailwindcss": "^0.8.1",
|
|
@@ -57,8 +56,7 @@
|
|
|
57
56
|
"sideEffects": false,
|
|
58
57
|
"peerDependencies": {
|
|
59
58
|
"svelte": "^5.57.0",
|
|
60
|
-
"typescript": "^6.0.3"
|
|
61
|
-
"@urbicon-ui/shared-types": "^8.0.0"
|
|
59
|
+
"typescript": "^6.0.3"
|
|
62
60
|
},
|
|
63
61
|
"peerDependenciesMeta": {
|
|
64
62
|
"typescript": {
|