Skip to main content
PRONeed enterprise-grade codemods tailored to your codebase?

Assess, plan, evolve.

Reusable compiler-aware skills that help coding agents understand, plan, and safely evolve your codebase.

6 packages

Sort by
i18n

I18nize your codebase

  • transformation
  • migration
Mmohebifar avatarmohebifar
v1.0.47
70
2 months ago
i18n/23/remove-options

Modification of the InterpolationOptions type. In version 23.0.0, the ns property within InterpolationOptions is now constrained to be of type Namespace instead of being a string or a readonly string[]. This change requires you to adjust your code accordingly. ### Before ```ts const options = { interpolation: { escapeValue: false, }, }; //remove the options object property and keep all other relevant properties i18n.init({ options, }); ``` ### After ```ts i18n.init({}); ``` ,This codemod turns X into Y. It also does Z. Note: this is a contrived example. Please modify it. ### Before ```ts const options = { interpolation: { escapeValue: false, }, }; //preserve all the other pairs i18n.init({ lng: 'en', backend: { loadPath: '/locales/{{lng}}/{{ns}}.json', }, normalize: (type, value) => { switch (type) { case 'translation': return value.toUpperCase(); // Custom normalization for translations default: return value; } }, options, }); ``` ### After ```ts i18n.init({ lng: 'en', backend: { loadPath: '/locales/{{lng}}/{{ns}}.json', }, normalize: (type, value) => { switch (type) { case 'translation': return value.toUpperCase(); // Custom normalization for translations default: return value; } }, }); ``` ,This codemod turns X into Y. It also does Z. Note: this is a contrived example. Please modify it. ### Before ```ts i18n.init({ fallbackLng: 'en', lng: 'en', defaultNS: 'uwave', interpolation: { escapeValue: false, }, }); //remove interpolation key-object pair ``` ### After ```ts i18n.init({ fallbackLng: 'en', lng: 'en', defaultNS: 'uwave', }); ```

  • i18n
  • breaking changes
  • +2
Ddfordp
v1.0.0
17
2 years ago
i18n/remove-unused-translations

This codemod removes unused i18n translations. ## Example > This codemod supports removing several i18n unused translation patterns. The example below shows only one of the cases that might occur. For an exhaustive list of the supported patterns, please refer to the codemod's [`test.ts` file](./test.ts). ### Before: ```jsx import { useLocale } from "@calcom/lib/hooks/useLocale"; export default function A() { const { t } = useLocale(); return <p>{t("key1")}</p>; } ``` ### After: ```jsx { "key1": "key1", "key2": "key2" } ```

  • migration
CCodemod
v1.0.4
8
a year ago
i18n/23/add-namespace-type-annotation

Modification of the InterpolationOptions type. In version 23.0.0, the ns property within InterpolationOptions is now constrained to be of type Namespace instead of being a string or a readonly string[]. This change requires you to adjust your code accordingly. ## Example ### Before ```ts function translateWithNs(key, ns) { return i18n.t(key, { ns }); } ``` ### After ```ts function translateWithNs(key, ns: Namespace) { return i18n.t(key, { ns }); } ```

  • i18n
  • breaking changes
  • +4
Ddfordp
v1.0.0
18
2 years ago
i18n/23/i18next-replace-keyswithseparator-with-joinkeys

Renaming types or functions can be part of an effort to clarify the library's API, deprecate old functionality, or introduce new features. In this case, KeysWithSeparator has been renamed to JoinKeys. This means wherever KeysWithSeparator was used in the codebase, it needs to be replaced with JoinKeys. ## Example ### Before ```ts import { KeysWithSeparator } from 'i18next'; const myTranslationFunction = (key: KeysWithSeparator < string > ) => { // Function body remains the same }; ``` ### After ```ts import { JoinKeys } from 'i18next'; const myTranslationFunction = (key: JoinKeys < string > ) => { // Function body remains the same }; ```

  • i18n
  • breaking changes
  • +4
Ddfordp
v1.0.0
14
2 years ago
i18n-analyzer

Detects hard-coded strings in your app and leaves a comment to contact the Codemod team. For demo and pilot use.

  • i18n
  • internationalization
  • +1
Aalexbit-codemod avataralexbit-codemod
v0.1.2
196
a year ago

Build your own codemod!

Describe the migration you need and Codemod Agent will create a codemod for you.

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.