I am trying to create a loop for the mentioned code here so that it will look for english and french language instead of hardcoded for english and french
var language = context.getVariable("google.dialogflow.language");
if (language.toLowerCase().includes("en")) {
context.setVariable("google.dialogflow.language", "en");
}
else if (language.toLowerCase().includes("fr")) {
context.setVariable("google.dialogflow.language", "fr");
}
I tried a simple loop to do the same work
1