我需要创建一个多语言聊天机器人以与 dialogFlow 进行原生反应

I need to creat a multi language chatbot in react native with dialogFlow

我需要在我的聊天机器人中添加多语言支持。

这里是我遵循的一些代码和 link 教程。

https://blog.jscrambler.com/build-a-chatbot-with-dialogflow-and-react-native/

此处指定 --> Dialogflow_V2.LANG_ENGLISH_US, 但是我需要多语言...

 componentDidMount() {
  Dialogflow_V2.setConfiguration(
    dialogflowConfig.client_email,
    dialogflowConfig.private_key,
    Dialogflow_V2.LANG_ENGLISH_US,
    dialogflowConfig.project_id
  );
}

使用react-native-localize添加多语言支持能力。

您可以将 react-native-localizeI18n-js 一起使用(但也可以与 react-intl、react-i18next 等一起使用。选择权在您手中!)

⚠️ 弃用:

我们可以使用名为 react-native-i18n 的国际化模块在我们的 React Native 项目中添加多种语言。

将以下模块与您的项目一起安装到 link。

npm i react-native-i18n --save

详情请看How to add localization (i18n, g11n) and RTL support to a React Native project.

Set the language in your configuration: that you can set your own language suport in chatbot:



 componentDidMount() {
  Dialogflow_V2.setConfiguration(
   dialogflowConfig.client_email,
   dialogflowConfig.private_key,
   Dialogflow_V2**.LANG_ENGLISH_US,**
   dialogflowConfig.project_id
 );
}

LANG_CHINESE_CHINA

LANG_CHINESE_HONGKONG

LANG_CHINESE_TAIWAN

LANG_DUTCH

LANG_ENGLISH

LANG_ENGLISH_GB

LANG_ENGLISH_US

LANG_FRENCH

LANG_GERMAN

LANG_ITALIAN

LANG_JAPANESE

LANG_KOREAN

LANG_PORTUGUESE

LANG_PORTUGUESE_BRAZIL

LANG_RUSSIAN

LANG_SPANISH

LANG_UKRAINIAN