OfficeDev/teams-toolkit

Implementation of Translation in Teams Bot adaptive cards

Closed this issue · 11 comments

IAM5K commented

Is your feature request related to a problem? Please describe.
Our product is live on store and we got some users from different countries preferring to use the app in their preferred language.
We are continuously getting requests to implement translations.

Describe the solution you'd like
Solutions i am looking for:

  1. Is there an existing way or method for translation
  2. If not what approach should we prefer so that we don't mess up with optimization and the accuracy of translations

Describe alternatives you've considered
Our known approaches:

  1. Based on user preferred language, use en.json, italian.json, etc.
  2. Use google translation api and dynamically populate all adaptive cards.

Additional context
Add any other context or screenshots about the feature request here.

IAM5K commented

https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/build-and-test/apps-localization

Found a relevant way of bot localisation. Please review this once if you have any suggestions or updates to this.

We can close this issue if you have nothing to add.

Hi @IAM5K, sorry that my last reply seems have been swallowed due to network issue. We don't have preference on the way to localize your adaptive cards, please choose either way according to your needs.

IAM5K commented

Thanks for the info, @HuihuiWu-Microsoft

I would like to ask one more question please.

In direct to bot /personal conversation with bot we can smoothly handle the localisation but is the same possible when the app is added in 1:1 conversation of Alice and Bob where Alice prefers English and Bob prefers Italian.
Is there a way or parameters in adaptive cards to have both language strings as parameters to be binded/passed to card and users can see the same translated card based on preference.

Please let me know if you are able to understand the scenario. Feel free to revert back if you have any doubts

Hi @IAM5K, I'm trying to understand your question. In 1:1 conversation of Alice and Bob, when one of them interact with bot, bot will send localized replies to user based on user locale. Why both language strings are needed to be passed? Could you describe more about your scenario?

IAM5K commented

Lets take a scenario,
we are making a meeting / note taking bot. Where either Alice or Bob give command @botName note: This a sample string to keep notes.

After taking notes bot send a acknowledgement card that is common for both. When Alice is using teams app in Italian they can see the same card in their preferred language.

@IAM5K You can always send localized contents based on user's locale. But the questions is how to get each member's(Alice and Bob) locale. In the existing localization sample(https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/app-localization/nodejs), the locale is obtained from turnContext.activity which is for current text field. But I don't see any API for getting locale of each member in groupchat or channel.

BTW, user might be able to set following translation settings in Teams to get messages with desired locale.
image

IAM5K commented

We can use graph api to extract members details.
Then update the values for language strings for each.

What I am trying to explore is how one single card can be made capable of showing itself in different languages

That's OK if you use Graph API though the locale info might not the same with Teams settings.

I don't quite understand: it should be the same with what you do for personal conversation with bot as long as you obtained the locale for each member. Just pass the locale and get localized content, then send the card.

IAM5K commented

I will implement this and then get back if there is any issue.

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

Due to lack of details for further investigation, we will archive the issue for now. In case you still have following-up questions on this issue, please always feel free to reopen the issue by clicking ‘reopen issue’ button below the comment box. We will get back to you as soon as possible.