August 8, 2023

How to extend Teams PowerTools to support non English Client setting

I explain in this post how to extend or modify the Teams PowerTool to support Teams Client in another language than English.

Language specific implementation

You can identify the language specific implementation in the code by looking for occurence of the command

.FindFirstByName


How to extend for your language

An example for the Mute function of implementation making use of the Teams_GetLang() function explained in a previous post:

Lang := Teams_GetLang()
Switch Lang
{
;Case "DE-DE":
Default:
MuteName := "Mute"
UnmuteName := "Unmute"
}

El :=  TeamsEl.FindFirstByNameAndType(MuteName, "button",,2)
If El {
    If (State = 0) {
        Tooltip("Teams Mic is alreay on.")
        return
    } Else {
        Tooltip("Teams Mute Mic...")
        El.Click()
        return
    }
}
El :=  TeamsEl.FindFirstByNameAndType(UnmuteName, "button",,2)
If (State = 1) {
    Tooltip("Teams Mic is alreay off.")
    return
} Else {
    Tooltip("Teams Unmute Mic...")
    El.Click()
    return
}

To get the Name of the UI Element, I recommend to use Microsoft Accessibility Insights or the UIAViewer provided by Descolada with his UIAutomation Librabry:


Adapt then in the code above with your language specific implementation.


N.B.: You need also to adapt the Teams_GetMeetingWindow() to your specific language,
See in the YouTube video how you can do it.

Example for de-de language is implemented in https://github.com/tdalon/ahk/blob/main/Lib/Teams.ahk .
Teams_IsMeetingWindow(TeamsEl,ExOnHold:=true){
; does not return true on Share / Call in progress window

; If Meeting Reactions Submenus are opened AutomationId are not visible.

Lang := Teams_GetLang()
Switch Lang
{
Case "de-de":
    CallingControlsName := "Besprechungssteuerung"
    ResumeName := "Fortsetzen"
Case "en-US":
    CallingControlsName := "Calling controls"
    ResumeName := "Resume"
Default:
    CallingControlsName := "Calling controls"
    ResumeName := "Resume"
}

If TeamsEl.FindFirstByName(CallingControlsName) {
    ;or TeamsEl.FindFirstBy("AutomationId=meeting-apps-add-btn") or TeamsEl.FindFirstBy("AutomationId=hangup-btn") or TeamsEl.FindFirstByName("Applause"))
    If (ExOnHold) { ; exclude On Hold meeting windows
        If TeamsEl.FindFirstByName(ResumeName) ; Exclude On-hold meetings with Resume button ; TODO #lang specific
            return false
    }
    return true
}
return false
} ; eofun

Special characters like ä, ü

For the German language I have stumbled upon the issue that names can use special characters like ä,ü
Example for the Meeting reactions Überracht (Surprised) and Gefällt mir (Like)
To get these characters to work, you need to save the ahk file explictly in "UTF-8 with BOM" instead of UTF format.
You can do this with Notepad.



See also

How to get Teams Client Language Setting

Teams PowerTool Language support - YouTube

No comments:

Post a Comment