Configuration

Configure Stringer CLI settings for your project

How Configuration Works

Stringer CLI stores project-specific configuration in your home directory at ~/.stringer-cli.json. Each project is identified by its package.json name.

Configuration Structure

When you run stringer, configuration is created and updated automatically:

{
  "framework": "nuxt",
  "baseLanguage": "en-us", 
  "targetLanguages": ["es-es", "fr-fr"],
  "outputDir": "./i18n/locales",
  "packageManager": "pnpm",
  "folders": ["."],
  "ignoredFiles": []
}

Configuration Properties

PropertyDescriptionExample
frameworkDetected framework"vue", "nuxt"
baseLanguageSource language code"en-us", "fr-fr"
targetLanguagesTarget languages array["es-es", "fr-fr", "de-de"]
outputDirWhere locale files are stored"./i18n/locales"
packageManagerDetected package manager"npm", "pnpm"
foldersFolders to process["."], ["src"]
ignoredFilesFile patterns to ignore["**/*.test.*"]

Framework Behavior

Vue Projects:

  • Uses vue-i18n
  • Function: const { t } = useI18n()
  • Files: src/**/*.{vue,js,ts}

Nuxt Projects:

  • Uses @nuxtjs/i18n
  • Function: const { t } = useI18n()
  • Server: const t = await useTranslation(event)
  • Files: pages/**/*, components/**/*, server/**/*

Updating Configuration

Configuration happens automatically when you use Stringer:

# Re-run to update settings
stringer

Follow the prompts to update:

  • Target languages
  • Output directory
  • Folders to process
  • File patterns to ignore

Configuration Location

  • Global Config: ~/.stringer-cli.json
  • Project Detection: Based on package.json name
  • Per-Project: Each project maintains separate settings

Cache & Config Management

If you're experiencing issues with file detection or configuration, you can reset these from the Advanced menu:

You can also clear the cache directly with:

stringer --clear-cache

Common Issues

Configuration Not Found

  • Run stringer to automatically create configuration
  • Ensure you're in a directory with package.json

Wrong Framework Detected

  • Re-run stringer and manually select the correct framework

Lost Configuration

  • Configuration is preserved when you re-run stringer
  • Project settings are maintained across sessions

Reactive Data Tips

When using translated strings in lists or dropdowns, use computed to react to language changes:

// ❌ Won't update when language changes
const menuItems = [
  { label: t('menu.home'), value: 'home' }
]

// ✅ Reacts to language changes
const menuItems = computed(() => [
  { label: t('menu.home'), value: 'home' }
])

Next Steps