{"id":48168,"library":"i18n-tag-schema","title":"i18n-tag-schema","description":"Generates a JSON schema from i18n-tagged template literals in a JavaScript project for translation key validation and autocompletion in JSON translation files. Version 2.5.0 is stable, with regular releases (semantic-release). Key differentiators: detects template literals tagged with i18n from es2015-i18n-tag, supports custom translation groups, file module groups, export of translation keys, and built-in JSON validator for coverage. Ships TypeScript types and works with Node >= 8.10.","status":"active","version":"2.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/skolmer/i18n-tag-schema","tags":["javascript","JS","ES6","ES2015","Intl","l10n","i18n","translation","typescript"],"install":[{"cmd":"npm install i18n-tag-schema","lang":"bash","label":"npm"},{"cmd":"yarn add i18n-tag-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add i18n-tag-schema","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime dependency for i18n tagged template literals that this tool detects","package":"es2015-i18n-tag","optional":true},{"reason":"Used for file pattern matching","package":"glob","optional":false},{"reason":"Generates JSON Schema output","package":"json-schema","optional":false}],"imports":[{"note":"ESM module; for CommonJS use require('i18n-tag-schema').generateSchema","wrong":"const generateSchema = require('i18n-tag-schema')","symbol":"generateSchema","correct":"import { generateSchema } from 'i18n-tag-schema'"},{"note":"Default import is not available; named export only","wrong":"const validateTranslationFile = require('i18n-tag-schema').validateTranslationFile","symbol":"validateTranslationFile","correct":"import { validateTranslationFile } from 'i18n-tag-schema'"},{"note":"TypeScript users should use type import for SchemaOptions interface","wrong":null,"symbol":"default (SchemaOptions)","correct":"import type { SchemaOptions } from 'i18n-tag-schema'"}],"quickstart":{"code":"import { generateSchema, validateTranslationFile } from 'i18n-tag-schema';\n\nconst schema = generateSchema({\n  rootPath: './src',\n  // Optional: customize output\n  // output: './schema.json',\n});\n\n// Or validate a translation file\nconst result = validateTranslationFile('./translations/en.json', schema);\nconsole.log(result);\n// { valid: false, missing: ['hello'], extra: ['bye'], coverage: 0.5 }","lang":"typescript","description":"Generates a JSON schema from i18n-tagged literals in project and validates a translation file for coverage."},"warnings":[{"fix":"Ensure all translation strings use i18n`...` syntax from the es2015-i18n-tag package.","message":"Only i18n-tagged template literals (using es2015-i18n-tag) are detected; other translation patterns are ignored.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use __translationGroup = 'groupName' in your source files instead of passing customTranslationGroups to generateSchema.","message":"The 'customTranslationGroups' option replaced by '__translationGroup' constants in code.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Set rootPath to the root of your source code (e.g., 'src' or '.'). The tool resolves __translationGroup relative to rootPath.","message":"rootPath must be set correctly; otherwise schema might miss files or be empty.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use validateTranslationFile() to compare schema keys against an actual JSON translation file.","message":"The schema output does not include translations, only key definitions. You must combine it with a translation file for validation.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use async/await or .then() when calling generateSchema(). For Node 8+, update to latest.","message":"Version 2.0.0 removed support for Node < 8.10 and changed the API from callback-based to promise-based for generateSchema.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use 'npx i18n-tag-schema generate' or update scripts.","message":"The cli command 'i18n-tag-schema' is replaced by 'i18n-tag-schema generate'.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Pass an object with 'file' property for output destination.","message":"The 'output' option as a string is deprecated; use { output: { file: 'path' } } instead.","severity":"deprecated","affected_versions":">=2.2.0"}],"env_vars":null,"search_vec":"'2.5.0':30 '8.10':78 'autocomplet':24 'built':65 'built-in':64 'coverag':70 'custom':53 'detect':41 'differenti':40 'es2015':49,82 'es2015-i18n-tag':48 'es6':81 'export':59 'file':28,56 'generat':5 'group':55,58 'i18n':2,11,46,50,85 'i18n-tag-schema':1 'i18n-tagged':10 'intl':83 'javascript':17,79 'js':80 'json':7,26,67 'key':21,39,62 'l10n':84 'liter':14,43 'modul':57 'node':77 'project':18 'regular':34 'releas':35,38 'schema':4,8 'semant':37 'semantic-releas':36 'ship':71 'stabl':32 'support':52 'tag':3,12,44,51 'templat':13,42 'translat':20,27,54,61,86 'type':73 'typescript':72,87 'valid':22,68 'version':29 'work':75","created_at":"2026-06-07T16:55:15.127554+00:00","updated_at":"2026-06-07T16:55:15.127554+00:00","problems":[{"fix":"Use 'const { generateSchema } = require('i18n-tag-schema');' or switch to ESM import.","cause":"Using CommonJS require() incorrectly; generateSchema is a named export.","error":"TypeError: generateSchema is not a function"},{"fix":"Run 'npm install glob' to install it as a dependency.","cause":"Missing dependency 'glob' not installed automatically (peer dependency).","error":"Error: Cannot find module 'glob'"},{"fix":"Ensure you have i18n`...` literals in your code and set rootPath correctly (e.g., './src').","cause":"No i18n-tagged template literals found in the files scanned, or rootPath not pointing to source.","error":"Schema generation returned empty {}"},{"fix":"Add the missing 'community.name' key to your translation JSON.","cause":"Translation file missing a key that exists in the generated schema.","error":"ValidationError: data.community must have required property 'name'"},{"fix":"Ensure your project uses ES2015+ syntax and Node >= 8.10.","cause":"Using i18n-tag-schema on a file that does not support tagged template literals (e.g., old Node or non-ES2015+ environment).","error":"SyntaxError: Invalid or unexpected token"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"http://i18n-tag.kolmer.net","github":"https://github.com/skolmer/i18n-tag-schema","docs":null,"changelog":null,"pypi":null,"npm":"i18n-tag-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","productivity"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}