【发布时间】:2021-11-09 22:16:08
【问题描述】:
我有一个使用 contentEditable 文本设置的网站,这是用户可以编辑的文本内容,我需要设置翻译,以便当用户编辑此文本时,它会在 translations.json 文件中更新。我设置了一个 redux 存储,其中存储的操作与传递给资源的 translations.json 文件的外观完全相同。问题是我真的不知道如何让 next-i18n 使用这个 store 作为翻译资源。
next-i18n 文档说我应该在配置中设置翻译:
export async function getServerSideProps({locale}) {
return {
props: {
...await serverSideTranslations(locale, ['common', 'slide1'], config
),
}
}
}
配置可以包含资源,但我不能在 getServerSideProps 中使用 redux 选择器。
【问题讨论】:
标签: reactjs next.js i18next react-i18next next-i18next