【问题标题】:i18next failing to load translation file: "there is a typo"i18next 无法加载翻译文件:“有错字”
【发布时间】:2014-08-01 14:27:41
【问题描述】:

我已经创建了翻译文件,在jsonlint 进行了验证,确保翻译文件位于 /locales/translation-en.json。

我一直收到错误,

There is a typo in: locales/translation-en.json

我很难过……这是我的翻译 json。

{
   "tab":{
      "legionella":"LEGIONELLA",
      "logbook":"LOGBOOK"
   },
   "representative":{
      "tag":"Representative: __rep__ — Phone: __phone__ — ",
      "email":"Click here to email your rep"
   },
   "portlet":{
      "contacts":{
         "title":"Contacts",
         "type":"Contact<br>Type",
         "name":"Contact<br>Name",
         "phone":"Phone<br>Number",
         "type_context_1":"Owner",
         "type_context_2":"Maintenance",
         "type_context_3":"Other"
      },
      "samples":{
         "title":"Legionella Samples",
         "sampleDate":"Sample<br>Date",
         "transmitForm":"Transmittal<br>Form",
         "certOfAnalysis":"Certificate<br>of Analysis",
         "concentration":"Concentration<br>(UFC/L)",
         "correctAction":"Corrective<br>Action",
         "range_context_1":"Interference",
         "range_context_2":"Less than 10,000 UFC/L",
         "range_context_3":"Between 10,000 to 1,000,000 UFC/L",
         "range_context_4":"Greater than 1,000,000 UFC/L"
      },
      "serviceReports":{
         "title":"Service Reports",
         "date":"Report<br>Date"
      },
      "maintenance":{
         "title":"Maintenance Programs",
         "popup":"Create New Maintenance Program",
         "type":"Program<br>Type",
         "date":"Effective<br>Date",
         "document":"Program<br>Document",
         "type_context_1":"Water Treatment",
         "type_context_2":"Mechanical",
         "type_context_3":"Schematic",
         "type_context_4":"O&M Manual",
         "popup_type":"Type",
         "popup_date":"Effective Date",
         "popup_document":"Document",
         "popup_save":"Save Maintenance Program"
      },
      "history":{
         "title":"System History",
         "popup":"Create New System History Entry",
         "date":"Event<br>Date",
         "type":"Event<br>Type",
         "details":"Event<br>Details",
         "type_context_1":"Breakage",
         "type_context_2":"Repair",
         "type_context_3":"Decontamination",
         "type_context_4":"Replacement"
      },
      "reminders":{
         "title":"Reminders",
         "date":"Date",
         "description":"Description"
      },
      "emails":{
         "title":"Emails",
         "date":"Date",
         "subject":"Subject",
         "recipient":"Recipient"
      }
   },
   "common":{
      "view":"View",
      "registryList":"Registry: ",
      "signout":"Sign Out"
   }
}

【问题讨论】:

  • 我不确定,但我认为您需要转义“/”字符,所以在这种情况下:“UFC/L”必须变为“UFC\/L”。再说一遍:我还不能测试这个
  • 很遗憾,这没有用。

标签: json i18next


【解决方案1】:

所以,我找到了问题所在。我没有提供原始问题中所需的所有详细信息。我没有让大家知道的是 json 文件位于 Netsuite 中。 Netsuite 不喜欢提供 .json 文件。当我将它转换为 .json.txt 时,一切都很好。谢谢!

【讨论】:

    【解决方案2】:

    万一有人错过了显而易见的事情..

    JSON 与 Javascipt 不同,需要引用键。

    有效的 JSON:

     { "foo": "bar" }
    

    无效的 JSON:

     { foo: "bar" }
    

    【讨论】:

      【解决方案3】:

      因为当搜索“i18next 有一个错字”时,这个问题在 Google 中的弹出率很高,所以你可以这样做。

      使用 JSON 验证工具。如果无效,请更正错误并重试。

      【讨论】:

        猜你喜欢
        • 2013-07-21
        • 2019-03-03
        • 2021-09-24
        • 1970-01-01
        • 2020-11-24
        • 2016-08-15
        • 2022-10-13
        • 2016-10-15
        • 1970-01-01
        相关资源
        最近更新 更多