JS Objects (js)
JavaScript object format uses .js files that export locale data as a default export or named constant. This format is common in Vue.js projects using vue-i18n, older React projects, and Nuxt 2 applications. Unlike JSON, JS locale files can include comments, computed values, and imports from shared modules — making them more flexible but less portable.
JS locale files export a plain JavaScript object using CommonJS or ES module syntax. Keys map to string values or nested objects. Comments can appear anywhere using standard JavaScript syntax. Interpolation syntax depends on the consuming library — typically double-brace variable names for vue-i18n or i18next. The file extension is .js and the exported object is consumed directly by the i18n library.
Best practice: consider migrating from JS object format to JSON for new projects — JSON is more portable, supported by more analysis tooling, and integrates directly with Language Monster's file sync without a transpilation step. If you retain .js format, avoid dynamic expressions or imports in locale objects as these cannot be statically extracted for translation. Language Monster supports the JavaScript object format and processes the exported object structure.
