diff --git a/README.md b/README.md index 5997dc6..d3094f7 100644 --- a/README.md +++ b/README.md @@ -43,8 +43,8 @@ npx i18n-scan # If installed globally i18n-scan -# Run locally during development -npm run dev +# Run locally during development (note the -- before flags) +npm run dev -- [options] # Run built version locally npm start @@ -57,16 +57,31 @@ npm start npm run dev ./src # Scan with custom file extensions -npm run dev ./src --ext .tsx,.jsx,.ts,.js +npm run dev ./src -- --ext .tsx,.jsx,.ts,.js # Scan with custom attributes -npm run dev ./src --attributes title,alt,placeholder,aria-label +npm run dev ./src -- --attributes title,alt,placeholder,aria-label + +# Filter out non-alphabetic text (symbols, emojis, numbers only) +npm run dev ./src -- --filter-non-alpha + +# Extract from objects, function calls, and schemas +npm run dev ./src -- --include-literals + +# Combine options +npm run dev ./src -- --filter-non-alpha --truncate 50 + +# When using npx or installed globally, no -- needed: +npx i18n-scan ./src --filter-non-alpha --truncate 50 ``` ### Options - `-e, --ext `: Comma-separated list of file extensions (default: `.tsx,.jsx`) - `-a, --attributes `: Comma-separated list of attribute names to extract (default: `title,alt,placeholder`) +- `-t, --truncate `: Truncate text to this length, 0 to disable (default: `30`) +- `-f, --filter-non-alpha`: Filter out text containing only non-alphabetic characters (e.g., `$`, `123`, `🎉`) +- `-l, --include-literals`: Include string literals from objects, function calls, and validation schemas ## Example Output @@ -77,6 +92,17 @@ npm run dev ./src --attributes title,alt,placeholder,aria-label [src/components/Form.tsx:13] This field is required ``` +**With `--filter-non-alpha` enabled:** + +``` +# Without filter: +[src/components/ProductCard.tsx:30] $ +[src/components/ProductCard.tsx:33] In Stock + +# With filter ($ is filtered out): +[src/components/ProductCard.tsx:33] In Stock +``` + ## Development - `npm run dev `: Run from TypeScript source @@ -85,6 +111,8 @@ npm run dev ./src --attributes title,alt,placeholder,aria-label ## What it extracts +### By default (JSX only): + 1. **JSX Text Content**: Any text between JSX tags ```jsx @@ -99,6 +127,50 @@ npm run dev ./src --attributes title,alt,placeholder,aria-label