i18next 的 React-native 后端

React-native backend for i18next

如何在 RN 中加载翻译 json 文件?在浏览器中,我 can use 获取和 XHR,但在应用程序中,它必须是某种文件系统访问,并将翻译复制到 ./android/app/src/main/assets/ 文件夹?

我们使用 xhr-backend 加载。还不需要将它们缓存在 asyncStorage 上,但这样做会相当容易 - 使用 asyncStorage

复制 https://github.com/i18next/i18next-localStorage-cache

或使用 i18next.addResourceBundle 添加它们:https://www.i18next.com/api.html#addresourcebundle

或者使用 webpack 打包器:https://github.com/atroo/i18next-resource-store-loader

但是来自 phone 文件系统的加载程序也很棒,还不知道是否有人构建了它。