https://docs.grit.io/cli/quickstart
engine marzano(0.1)
language js
private pattern handle_custom_i18n() {
any {
js"$t($i18n)`$message`" => js"$i18n._(msg`$message`)" where {
$t <: "t",
$t <: imported_from(from=`'@lingui/core/macro'`),
$msg = `msg`,
$msg <: ensure_import_from(`"@lingui/core/macro"`),
},
js"$t($i18n)($descriptor)" => js"$i18n._(msg($descriptor))" where {
$t <: "t",
$t <: imported_from(from=`'@lingui/core/macro'`),
$msg = `msg`,
$msg <: ensure_import_from(`"@lingui/core/macro"`),
}
}
}
sequential {
maybe bubble file($body) where $body <: contains handle_custom_i18n(),
maybe bubble file($body) where $body <: contains remove_unused_imports(),
}
import {t} from "@lingui/core/macro";
let i18n;
t(i18n)`Ola!`
import { msg} from "@lingui/core/macro";
let i18n;
i18n._(msg(`Ola!`))
import {t} from "@lingui/core/macro";
let i18n;
t(i18n)({message: `Ola!`})
import { msg} from "@lingui/core/macro";
let i18n;
i18n._(msg({message: `Ola!`}))