page_type | description | products | languages | extensions | contentType | createdDate | ||||
---|---|---|---|---|---|---|---|---|---|---|
sample |
Microsoft Teams app localization using Bot and Tab |
|
|
samples |
07-07-2021 13:38:25 |
This sample illustrates how to implement Localization for Microsoft Teams apps.
Verify you have the right account for building Teams apps and install some recommended development tools.
- You need a Teams account that allows custom app sideloading.
- .NET Core SDK version 3.1
- ngrok or equivalent tunnelling solution
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
If you are using Visual Studio
- Launch Visual Studio
- File -> Open -> Project/Solution
- Navigate to
app-localization\csharp
folder - Select
Localization.csproj
file
-
Run ngrok - point to port 3978
ngrok http --host-header=localhost
-
This step is related to Microsoft Teams app manifest
- Edit the
manifest.json
contained in theManifest
folder to replace your Microsoft App Id (that was created when you registered your bot earlier) everywhere you see the place holder string<<YOUR-MICROSOFT-APP-ID>>
(depending on the scenario the Microsoft App Id may occur multiple times in themanifest.json
) - Provide ngrok Url (turnnelling Url) in
manifest.json
for contentUrl in case of tabs and for messaging endpoint in case of bots if enabled. - Zip up the contents of the
teamsAppManifest
folder to create amanifest.zip
- Upload the
manifest.zip
to Teams (in the Apps view click "Upload a custom app")
- Edit the
-
Run your app, either from Visual Studio with
F5
or usingdotnet run
in the appropriate folder.
In Teams, Once the app is successfully installed, you can interact with tab and bot in your preferred language.
To change the language in Microsoft Teams, please click your profile picture at the top of the app, then select Settings -> General and go to the Language section. Choose the preferred language and restart to apply the change. This sample supports en-US, fr-CA, hi-IN and es-MX.
Add Resource files for the respective languages, Check culture fallback behaviour and how to add other cultures refer Globalization and localization Fundamentals.