使用i18next.getFixedT()时日期的无效翻译

时间:2019-12-06 06:09:20

标签: reactjs frontend i18next react-i18next

我们的团队正在使用i18next.getFixedT()在我们的应用程序中进行翻译。当我们通过日期时会出现问题,然后将其转换为某些垃圾值[ "2018-03-31 19:52:26" => "52false26"]

我们通过仅将表头[FooTable]而不是整个表传递给翻译器来解决了这个问题,但是我被告知这不应该发生,因为发送了没有翻译的内容照原样返回,无需更改。 PS:我是一个刚接触2个月的新手,刚开始使用React,所以对大多数事情都不了解。

这是主要功能(反应代码)

  {
    console.log(this.props);
    console.log('debugging');
    const { t, i18n } = this.props;
    var cellTextArr = this.props.name.split(",");
    let cellVal = this.props.data[cellTextArr];
    let cellText = "";
    if(cellTextArr[0] === this.props.header)
      cellText = this.props.userName;
    else{
      if(this.props.master === false)
        cellText = cellVal;
      else
        cellText = cellVal[0];
    }

    return(
            <td onClick={this.handleSummary} style={{cursor:"pointer", textAlign:"center"}} >{cellText}</td>
    );
  }
};

上一个代码

render()
  {
    const { t, i18n } = this.props;
    var cellTextArr = this.props.name.split(",");
    let cellVal = this.props.data[cellTextArr];
    let cellText = "";
    if(cellTextArr[0] === this.props.header)
      cellText = this.props.userName;
    else{
      if(this.props.master === false)
        cellText = cellVal;
      else
        cellText = cellVal[0];
    }

    return(
            <td onClick={this.handleSummary} style={{cursor:"pointer", textAlign:"center"}} >{t(cellText)}</td>
    );
  }
};



构建此软件的4个人中有3个人离开了组织。我的任务是了解和了解该软件。 一周前,我通过阅读教程开始反应,因此我的知识非常有限。

0 个答案:

没有答案