next-translate
next-translate copied to clipboard
Feature Request: API to replace translations on runtime
We are using a SaaS tool to manage our translations but if one translation has changed we want to call a webhook of next.js to invalidate the old translation and replace it with the new one.
It would be great to have a function to replace a translation:
function replaceTranslation(locale: string, namespace: string, newTranslation: string) {...}
replaceTranslation('en', 'common', 'This is the new translation.')
@sapkra is something unfeasible because being able to overwrite the function loadLocaleFrom
, the translations can be anywhere, in JSON or any format, inside the project, or in an external API... So reading the translations is feasible, but overwriting them is more complicated.
If you use the locals inside the project, you can overwrite them with fs
and revalidate the pages that have getStaticProps.