It is not a good practice to use ttag variables declaration on a module scope. Such as:
BAD:
import { t } from 'ttag';
const text = t`hello`;
Reason for this is that t
function will be called once, and language switch will not have effect on those variables. Instead you should consider to use something like
GOOD:
import { t } from 'ttag';
const text = () => t`hello`;
Let's consider we have this configuration in .eslintrc
:
{
"plugins": ["ttag"],
"rules": {
"ttag/no-module-declaration": 2
}
}
import { t } from 'ttag';
const text = t`hello`;