I18Next不能在Cordova iOS 6.1.0上翻译 [英] i18next doesn't translate on Cordova iOS 6.1.0

查看:26
本文介绍了I18Next不能在Cordova iOS 6.1.0上翻译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在iOS和Android上运行了多年的v1.10.x,但随着新的迁移到wkwebview i18Next(包括1.11.2),只会返回密钥。我很好奇是否有人在Cordova iOS 6.1.0、Cordova 9.0.0上成功地使用了i18Next,以及是否有人能发现我的错误。

[编辑]打开调试时,我收到此错误,尽管这有点帮助

2020-07-15 11:08:29.649177-0700 myapp[15438:5134539] error when loading /src/locales/en/translation.json

[/编辑]

下面是我的i18next初始化代码,min包由index.html加载。我将RESOURCES对象添加到init选项中,以查看我的转换.json文件是否有问题,但显式资源也不能转换。这个init在Cordova Android 9.0上运行良好。

      /* ******************* internationalization and go **************** */
  // initialize i18n, launch react in the callback so we're able to localize
  i18n.init(
    {
      fallbackLng: "en",
      debug: true,
      resources: {
        en: {
          translation: {
            "clf_js_Username": "Who ARE you?"
          }
        }
      }
    },
    function(err, t) {
      if (typeof err !== "undefined") {
        console.log("LH.iLE - initialization returned error >" + err + "<");
      }
      setTimeout(() => {
        console.log(
          "********** i.i18init is complete - starting react **********"
        );

        // setup the action groups for 'special' notifications
        // addKatzerActionGroups();

        //************** launch React+Redux **********

(废话--超时是一个魔术数字1000ms,以允许I18N初始化) );

推荐答案

安装此插件(Cordova-iOS 6+)

  cordova plugin add https://github.com/globules-io/cordova-plugin-ios-xhr

然后设置

  <preference name="AllowUntrustedCerts"  value="true" />
  <preference name="InterceptRemoteRequests" value="all" />
  <preference name="allowFileAccessFromFileURLs" value="true" />
  <preference name="allowUniversalAccessFromFileURLs" value="true" />

这篇关于I18Next不能在Cordova iOS 6.1.0上翻译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆