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

I need to put the multilanguage support in my chatBot.
here some code and link of tutorial that I followed.
https://blog.jscrambler.com/build-a-chatbot-with-dialogflow-and-react-native/
Here, is especified --> Dialogflow_V2.LANG_ENGLISH_US,
But i need the multilanguage...
componentDidMount() {
Dialogflow_V2.setConfiguration(
dialogflowConfig.client_email,
dialogflowConfig.private_key,
Dialogflow_V2.LANG_ENGLISH_US,
dialogflowConfig.project_id
);
}

Use react-native-localize to add the ability of multiple language support.
You can use react-native-localize with I18n-js (but also with react-intl, react-i18next, etc. The choice is yours!)
⚠️ Deprecated:
We can use an internationalization module named react-native-i18n to add many languages in our React Native projects.
Install the following module to link with your project.
npm i react-native-i18n --save
For more details, please go through How to add localization (i18n, g11n) and RTL support to a React Native project.
reference by

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

Related

Get FirebaseAuthPlatform for Flutter web RecaptchaVerifier

SITUATION:
I'm in the process of implementing Firebase phone sign-in on flutter web. In doing so, I want to customize the reCAPTCHA that is called by the signInWithPhoneNumber function as outlined in the Firebase documentation.
final ConfirmationResult confirmationResult = await auth.signInWithPhoneNumber(
phoneNumber, verifier_should_go_here
);
COMPLICATION:
I am trying to implement the RecaptchaVerifier, but it has a required parameter called FirebaseAuthPlatform, and I can't figure out how to generate this parameter for my app.
QUESTION:
How can I create a RecaptchaVerifier to pass to the signInWithPhoneNumber function on flutter web?
3 easy steps:
You add the firebase_auth_platform_interface dependency to your pubspec.yaml file with flutter pub add firebase_auth_platform_interface
You import the package like this: import 'package:firebase_auth_platform_interface/firebase_auth_platform_interface.dart' show FirebaseAuthPlatform;
Inside the constructor for RecaptchaVerifier, you use FirebaseAuthPlatform.instance

How to use Troisjs in Nuxt 3 project

I would like to use TroisJS (three.js wrapper for Vue) with Nuxt.js. According to the TroisJS documentation (https://troisjs.github.io/guide/install.html#existing-vuejs-3-project) I need to add it to my project like:
import { TroisJSVuePlugin } from 'troisjs';
app.use(TroisJSVuePlugin);
However, I don"t know how to figure out where I should put this code. I would expect the nuxt.config.js file, but I don't seem to quite get it where it should go.
I decided to use TroisJS and not three.js because I thought the former might be easier to import and use. If importing three.js directly is easier, I don't mind using it.
Thank you very much for any help!
In /plugins folder add new file named troisjs-plugin.js with the following content :
import { TroisJSVuePlugin } from 'troisjs';
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(TroisJSVuePlugin )
})
I found a repo with some testing with Trois and Nuxt 3, probably outdated and maybe some apis have changed, but if you wanna check it out: alvarosabu/nuxt3-trois
Also, there's an official repo from the Trois author with a Nuxt 3 custom plugin (probably outdated too) here

Marking an NPM module as deprecated in a single project

My team and I have a large collection of Enzyme tests in a project and we have recently decided to use React Testing Library moving forward.
We want to convert older Enzyme tests to RTL over time, so we're looking for a way to mark Enzyme as deprecated within our project. Are there any out-of-the-box options available?
We could wrap Enzyme functions in wrappers, then mark them as deprecated:
// enzyme.js
import * as Enzyme from 'enzyme';
/** #deprecated use React Testing Library instead */
export const mount = Enzyme.mount;
// some test
import { mount } from './enzyme';
But this means we have to update all instances of the Enzyme import, and we're hoping there's a simpler solution available.

When do you use react-native-push-notification vs #react-native-community/push-notification-ios?

I'm reading the installation instructions for react-native-push-notification and it indicates that for iOS, you use #react-native-community/push-notification-ios. It seems as though you have to add both of these modules separately. However, I don't understand which to use in my actual code. Do you use var PushNotification = require("react-native-push-notification"); as it says in react-native-push-notification, or do you use import PushNotificationIOS from "#react-native-community/push-notification-ios"; from #react-native-community/push-notification-ios?
You do have to have both packages in your package.json but you do not need to use PushNotificationIOS for anything other than a finish handler as shown in the usage section here.
Generally though, you would only need to use var PushNotification = require("react-native-push-notification") and call your handlers on that.

How to customize app.json to build a whitelabel app with Expo

I have an application written in React Native with Expo and I need to create about 20 more apps that are almost the same but have different backend and some styling. I have an idea how to do most of that but I'm stuck when it comes to using different app.json for every build without changing it manually each time. Of course, every separate application needs to use its own name and icon. So how should I do that?
Late answer incoming. Hope it is still relevant for you in some way.
As of today, in addition to the static app.json configuration file, you can write dynamic configuration in app.config.js.
So, with app.config.js you can define each white-label settings. Then, you can use environment variables to start your app with a specific white-label configuration.
For example, here's how you can have different app names per white-label.
Command to start expo: BRAND=WHITELABEL_1 expo start and BRAND=WHITELABEL_2 expo start, depending on which white-label you want to start.
app.config.js file:
const names = {
WHITELABEL_1: 'White-label 1 Name',
WHITELABEL_2: 'White-label 2 Name',
};
const name = names[process.env.BRAND];
export default { name };
That's how I'd approach white-labeling with Expo.