Can we traslate oAuth Prompt Text and Title to preferred language

Brass Contributor

We are using OAuthPrompt for signing verification in our bot project. Currently it is supporting only single language which is set at initialization time.
Is it possible to translate the OAuthPrompt Text and Title to user preferred language?

18 Replies
@Lakshmi_145 - Could you please share which document are you referring for this?

@Nivedipa-MSFT ,

 

We have added the below OAuthPrompt to waterfall dialog. 

 

AddDialog(new OAuthPrompt(
nameof(OAuthPrompt),
new OAuthPromptSettings
{
ConnectionName = ConnectionName,
Text = "Please Sign In",
Title = "Sign In",
Timeout = 300000
}));

 

For text and title,  we have added resource string for supporting different languages. But its taking the language which is at the time of initializing only later on its not translating to the user preferred language.

While calling the OAuthPrompt , its not getting translated to the current language which is set.

 

return await stepContext.BeginDialogAsync(nameof(OAuthPrompt), null, cancellationToken);

 

@Lakshmi_145 - Could you please refer below document for Localization.
Globalization and localization in ASP.NET Core | Microsoft Docs
Localization in .NET | Microsoft Docs

Could you please refer below sample also:
Microsoft-Teams-Samples/samples/app-localization/csharp at main · OfficeDev/Microsoft-Teams-Samples ...

Please let us know if you have any other query. Thanks

@Nivedipa-MSFT 

 

We have already done the localization. It will take the user preferred language while initialization. 

Later we have changed the user preferred language , but language of Oauth prompt is not getting changed. It will be the same language which is set at the initialization time.

 

Please find the attachment for Oauth prompt. Its values will be English if we have initialized in English and later if we change to German , still the Oauth prompt will be shown in English only

 

Is it possible to change the Oauth prompt Title and Text to the user selected language.

@Nivedipa-MSFT 

 

Yes our application is supporting multiple languages and we have done localization already and its working also

 

If the application is initialized in in German the resource string for Oauth prompt will be in German and if the application is initialized in English then the resource strings will be English.

On later if we change the application language , all other cards values are getting translated except this OauthPrompt , that is the issue we are having

 

@Lakshmi_145 

 

Currently Microsoft Oauth prompt is taking the local system language. 

 

If the language is set to German in our laptop and if we call the Oauth prompt, its taking the German resource string value . Later we changed the user preferred language to English and then we have set the culture again , but still Text and Title is taking the local system language which is German.

 

CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture = new CultureInfo("en");

return await stepContext.BeginDialogAsync(nameof(OAuthPrompt), null, cancellationToken);

 

 

Is there any possibility to change the culture while calling the Oauth prompt 

 

 

@Nivedipa-MSFT 

 

Currently Microsoft Oauth prompt is taking the local system language. 

 

If the language is set to German in our laptop and if we call the Oauth prompt, its taking the German resource string value . Later we changed the user preferred language to English and then we have set the culture again , but still Text and Title is taking the local system language which is German.

 

CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture = new CultureInfo("en");

return await stepContext.BeginDialogAsync(nameof(OAuthPrompt), null, cancellationToken);

 

 

Is there any possibility to change the culture while calling the Oauth prompt 

@Lakshmi_145 - We are checking this internally. We will update you soon.

@Nivedipa-MSFT 

 

When can we expect an update. We are working on this feature and currently its in blocked state. It will be good if you can update whether it is possible to do language translation for oauth prompt 

@Lakshmi_145 - Are you getting any event while setting the culture?

@Nivedipa-MSFT 

 

Culture is set at the initialization of app itself and we are not getting any events while setting the culture.

 

Oauth prompt is raised when we call the below method,

 

public override Task<DialogTurnResult> BeginDialogAsync(DialogContext dc, object options = null, CancellationToken cancellationToken = default);

 

 It will directly prompt the oauth prompt in UI . We have tried setting the culture just before this prompt , but still title and text is displayed in local system language

 

@Lakshmi_145 - Could you please check which culture is set before calling the OAuth Prompt.
Try with below code:
Console.WriteLine(System.Globalization.CultureInfo.CurrentCulture.ToString());

@Nivedipa-MSFT 

 

I have tried , its coming as Dutch , we have selected the user preferred language as Dutch and my local system language is English.

 

Please find the attached screen shot

@Nivedipa-MSFT ,

 

Is there any update on this , will it be possible to do translation for oauth prompt 

@Lakshmi_145 - The language info from Teams client of the user will be included in the response in the 1:1 messages from user to bot.

@Nivedipa-MSFT 

 

We have tried in Teams app by changing the app language to Dutch and then gave signin prompt. Still its taking English resource string as Title and text. I have attached the screen shot of Sign in prompt

@Lakshmi_145 - We got a confirmation from engineering team saying that

You have to do additional changes, just changing the language won't work. You need to update the bot to

a. read the language of the user from the installation event

b. create the sign in card with the fields in the right language based on the user locale

Then you should change the language in Teams, the bot will get the new language during install. If a and b are implemented the card will be sent in the right language back

Thanks, 

Nivedipa

----------------------------------------------------------------------------------

If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.