Can we traslate oAuth Prompt Text and Title to preferred language

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?

15 Replies
@Aiswarya_Lakshmy - 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);

 

@Aiswarya_Lakshmy - 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

 

@Aiswarya_Lakshmy 

 

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 

@Aiswarya_Lakshmy - 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 

@Aiswarya_Lakshmy - 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

 

@Aiswarya_Lakshmy - 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