Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个带有 next.js 和 next-i18next 的应用程序,用于国际化。我需要存储当前的语言环境,并试图弄清楚如何去做。也许在 _app.tsx 或 _document.tsx/ 我从哪里获得当前语言环境?从实例或上下文?
当前设置为 i18next.language。当您想知道设置了什么语言时,只需导入 i18n 实例,即import i18n from '../../i18n'。实例是使用创建的i18n.init()。
import i18n from '../../i18n'
i18n.init()