import { defineConfig } from 'i18next-cli';
import { SUPPORTED_LOCALES } from './src/features/i18n/conf';

export default defineConfig({
  locales: SUPPORTED_LOCALES,
  extract: {
    defaultNS: "common",
    input: ['src/**/*.{js,jsx,ts,tsx}'],
    output: "public/locales/{{namespace}}/{{language}}.json",
    // Use flat keys so natural-language strings can be used as full keys without nesting
    keySeparator: false,
    // Avoid splitting ns from key when authors include ':' in text
    nsSeparator: false,
    primaryLanguage: "en-US",
    functions: ['t', 'i18n.t'],
    // Keys built dynamically (e.g. AttachmentHelper.getFormatTranslationKey
    // → ``mime.pdf``) can't be resolved by static analysis; preserve them
    // so the extractor doesn't drop them on the next run.
    preservePatterns: ['mime.*'],
  }
});
