[Python] Unable to remove unused i18n dynamic keys

Discussão em 'Python' iniciado por Stack, Março 4, 2025.

  1. Stack

    Stack Membro Participativo

    I have a react codebase which uses i18n react package, we have couple of translation files, in some of the components we generate translation keys dynamically for instance

    priority__HIGH: "High"
    priority__MED: "Medium"
    priority__LOW: "Low"
    priority__low: "Low" // Unnecessarily repeated, need to remove this but not others

    and I am accessing these translations using i18n's useTranslation hook's t function as follows:-

    const t = useTranslation();
    return <h1>{t('priority__${priorities.High}')}</h1>;

    How can I use i18next-scanner or any other tool to remove the unused keys, but preserve others???

    Continue reading...

Compartilhe esta Página