Skip to main content

Add context for better translations

Sometimes you need to add some context to get the proper translation. For example, Retour in French could mean Return or Back, depending on the context. Or even Back could mean a back button or my back, who knows ?

import { I18nKeylessText } from "i18n-keyless-react";

return (
<I18nKeylessText context="This is a back button">
Retour
</I18nKeylessText>
);
}
import { getTranslation } from "i18n-keyless-react";

return (
<p>
{getTranslation('Retour', { context: "This is a back button" })}
</p>
);
}