{"id":25740,"library":"i18n-lint","title":"i18n-lint","description":"i18n-lint (v1.1.0) is a CLI and library tool for detecting hardcoded (untranslated) strings in HTML and template source files. It checks text nodes and attributes (default: alt, placeholder, title) against a list of built-in internationalization functions like `gettext()` and `i18n()`. Supports custom template delimiters (e.g., {{ }}, <%%>) for Mustache/Handlebars/EJS. Compiled with JSHint-compatible reporters and built-in default/unix/json output. Designed for Node.js >=0.8.0, with global install providing the `i18n-lint` binary. Key differentiator: it integrates linting into existing build pipelines via CLI or Node API, unlike gettext extraction tools.","status":"active","version":"1.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/jwarby/i18n-lint","tags":["javascript","hardcoded","strings","i18n","translation","i18n-lint","lint","untranslated","detect"],"install":[{"cmd":"npm install i18n-lint","lang":"bash","label":"npm"},{"cmd":"yarn add i18n-lint","lang":"bash","label":"yarn"},{"cmd":"pnpm add i18n-lint","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"CLI option parsing","package":"commander","optional":true},{"reason":"Colored terminal output","package":"chalk","optional":true},{"reason":"Utility functions (e.g., array/string operations)","package":"lodash","optional":false},{"reason":"Configuration file parsing","package":"js-yaml","optional":true},{"reason":"Object merging for options","package":"extend","optional":false}],"imports":[{"note":"Package uses ESM exports. CJS require() may not work due to module format.","wrong":"const i18nLint = require('i18n-lint');","symbol":"i18n-lint","correct":"import i18nLint from 'i18n-lint';\nconst results = i18nLint('file.html');"},{"note":"CLI entry point exposed for programmatic use; ensure correct path.","wrong":"const run = require('i18n-lint/cli').run;","symbol":"cli","correct":"import { run } from 'i18n-lint/cli.js';\nrun(['file.html']);"},{"note":"Linter class available from main export. Requires options object.","wrong":"const Linter = require('i18n-lint').Linter;","symbol":"Linter","correct":"import { Linter } from 'i18n-lint';\nconst linter = new Linter({ templateDelimiters: ['{{', '}}'] });"}],"quickstart":{"code":"import i18nLint from 'i18n-lint';\n// Lint a string with default options\nconst results = i18nLint('<p>Hello, world!</p>');\nconsole.log(results);\n// Output: Array of error objects like { line: 1, col: 3, message: 'Possible untranslated string...' }","lang":"typescript","description":"Basic usage: lint an HTML string for hardcoded text, logging results."},"warnings":[{"fix":"Use -t \"{{,}}\" for CLI or templateDelimiters: ['{{', '}}'] for API.","message":"Template delimiters option must be a comma-separated string or array, but if passed incorrectly may cause no errors to be reported.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use --attributes \"aria-label,custom-attr\" to include more.","message":"Default attributes checked are alt, placeholder, title; other attributes like data-* or aria-* are ignored unless specified via -a or attributes option.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Configure custom translation function names via options or .i18n-lintrc config file.","message":"The tool may report false positives for strings that are actually used as keys in a translation function but not recognized due to missing function patterns.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use --help for usage. Ensure input files exist.","message":"Exit code 1 indicates hardcoded strings found; exit code 0 means clean. Exit code 64 for usage errors.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using programmatic API or CLI flags instead.","message":"Options via .i18n-lintrc (YAML) are supported but undocumented; may change.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Update to latest version (1.1.0). If using custom reporter, ensure compatibility.","message":"Version 1.0.0 dropped support for Node <0.8.0 and changed default reporters.","severity":"breaking","affected_versions":">=1.0.0 <1.1.0"}],"env_vars":null,"search_vec":"'0.8.0':70 'alt':32 'api':93 'attribut':30 'binari':79 'build':87 'built':40,63 'built-in':39,62 'check':26 'cli':10,90 'compat':59 'compil':55 'custom':49 'default':31 'default/unix/json':65 'delimit':51 'design':67 'detect':15,108 'differenti':81 'e.g':52 'exist':86 'extract':96 'file':24 'function':43 'gettext':45,95 'global':72 'hardcod':16,99 'html':20 'i18n':2,5,47,77,101,104 'i18n-lint':1,4,76,103 'instal':73 'integr':83 'internation':42 'javascript':98 'jshint':58 'jshint-compat':57 'key':80 'librari':12 'like':44 'lint':3,6,78,84,105,106 'list':37 'mustache/handlebars/ejs':54 'node':28,92 'node.js':69 'output':66 'pipelin':88 'placehold':33 'provid':74 'report':60 'sourc':23 'string':18,100 'support':48 'templat':22,50 'text':27 'titl':34 'tool':13,97 'translat':102 'unlik':94 'untransl':17,107 'v1.1.0':7 'via':89","created_at":"2026-05-01T13:46:19.327109+00:00","updated_at":"2026-05-01T13:46:19.327109+00:00","problems":[{"fix":"Run `npm install i18n-lint` or `npm install -g i18n-lint`.","cause":"Package not installed or installed globally but not in node_modules.","error":"Error: Cannot find module 'i18n-lint'"},{"fix":"Use `import i18nLint from 'i18n-lint'` if using ESM; otherwise if CJS, use `const i18nLint = require('i18n-lint').default`.","cause":"Incorrect import (e.g., default import used on CJS build).","error":"TypeError: i18nLint is not a function"},{"fix":"Use absolute path or ensure file is relative to current working directory. E.g., `--reporter /path/to/reporter.js`.","cause":"Path to custom reporter file is incorrect or file doesn't exist.","error":"Error: Repoter \"custom.js\" not found"},{"fix":"Specify correct delimiters with -t option, e.g., -t \"{{,}}\" for Handlebars, -t \"<%,%>\" for EJS.","cause":"Template delimiters not matching actual template syntax.","error":"SyntaxError: Unexpected token ILLEGAL (in template parsing)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"i18n-lint","cli_version":null,"type":"library","homepage":"https://jwarby.github.io/i18n-lint","github":"https://github.com/jwarby/i18n-lint","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/i18n-lint","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}