Skip to content

Configuration Reference

i18n-sharpen can be configured using an i18n-sharpen.json file in your root workspace directory, or via an "i18nSharpen" field in your package.json.


Configuration Schema

Here is a full list of available options:

OptionTypeDefaultDescription
scanDirsstring[]["src"]Folders to scan for translation keys.
localesDirstring"src/locales"Directory containing your locale files.
defaultLanguagestring"en"The fallback language.
supportedLanguagesstring[]["en"]List of all supported languages.
excludeDirsstring[]See belowFolders ignored during scanning.
fileExtensionsstring[]See belowFile extensions to check.
matchFunctionsstring[]["t", "getTranslation"]Function names used for translation in code.
matchAttributesstring[]["i18nKey", "id"]HTML/JSX attributes scanned for translation keys.
outputReportstring"i18n-coverage.md"Path to write markdown quality report ("" to disable).
localesLayout"flat" | "namespaced""flat"Locale directory layout under localesDir.
defaultNamespacestring"common"Namespace used for keys without a prefix (namespaced layout only).
prune.forcebooleanfalseMake prune write by default without --force flag.
prune.cleanEmptybooleanfalseDelete empty namespace files after pruning.
looseKeyMatchbooleanfalseIf true, quoted matches of keys in raw code count as "used".
ignoreKeysstring[][]Glob patterns (e.g. status.*) to ignore during validation, checks, and pruning.
ignoreDynamicKeysstring[][]Glob prefixes to suppress from dynamic-key warnings.
autoIgnoreDynamicPrefixesbooleantrueAutomatically treat structured-concat dynamic prefixes (e.g. landing.hero.) as wildcard ignores to protect them from pruning.
pluralSuffixesstring[]See belowPlural suffixes to automatically match and preserve.
sortKeys"alpha" | "source" | "preserve""preserve"Ordering of keys on writes.
hardcoded.attributesstring[]See belowHTML/JSX attributes scanned for hardcoded strings.
hardcoded.ignorestring[][]Hardcoded text strings/regex patterns to ignore.
metadataFilestring"metadata.json"Path to save extracted translation context metadata relative to localesDir (empty/falsy to disable).
strictFallbacksbooleanfalseFail validation if any translations match their default fallback values (untranslated fallbacks).
ignoreFallbackKeysstring[][]Key patterns (supports wildcards like brand.*) to ignore during untranslated fallback validation.
stubPlaceholderstring"key"Initial translation value populated during extraction. Mode "key" uses the key path, "default" copies default language value, or any custom string. Note: "key" and "default" are reserved mode words.

Default Values

Default Excluded Directories (excludeDirs)

json
[
  "node_modules",
  "dist",
  ".git",
  ".next",
  "build",
  "coverage",
  ".agent",
  ".claude"
]

Default Extensions Scanned (fileExtensions)

json
[".ts", ".tsx", ".js", ".jsx", ".vue", ".svelte", ".astro"]

Default Plural Suffixes (pluralSuffixes)

Used to avoid false-positive warnings for plural keys. If key is used in code, suffixes of key are automatically marked as used.

json
["_zero", "_one", "_two", "_few", "_many", "_other", "_male", "_female"]

Default Hardcoded Attributes Scanned (hardcoded.attributes)

json
["placeholder", "label", "title", "alt", "aria-label"]

Released under the MIT License.