NeoIQ Localize

JavaScript

NeoIQ Localize supports JavaScript/TypeScript localization files, perfect for modern web applications. This format handles both object literals and module exports, supporting nested structures and dynamic content.


Setting Up

First, make sure you've got a neoiq-localize.json config file in your project root. Here's an example:

{
  "locale": {
    "source": "en",
    "targets": ["sv", "de", "fr"]
  },
  "files": {
    "js": {
      "include": ["src/locales/[locale].js"]
    }
  }
}

Translating

With your config set, run:

npx @neoiq/localize@latest translate

When you run this command, NeoIQ Localize will:

  • Load your source JavaScript files (e.g., src/locales/en.js)
  • Detect any new or modified translation strings
  • Generate translations for your target languages
  • Create or update the target language files (e.g., src/locales/sv.js)
  • Preserve module structure and exports
  • Handle nested objects and arrays
  • Maintain code formatting and comments
  • Generate TypeScript types if enabled

How is this guide?

Edit on GitHub

Last updated on

On this page