You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we rely on the OS language in order to select language-specific filter lists.
This may not be enough. For instance, the user may prefer to use English as the default language by OS, but they could actually be a speaker of a different language.
Proposed solution
In addition to that OS language we need to also rely on available keyboard layouts and extract language codes from it.
Code example to select available keyboard layouts:
import Foundation
import Carbon
func getAvailableKeyboardLayouts() -> [String] {
var layouts: [String] = []
// Create a search dictionary to filter for keyboard input sources
let searchDict: [String: Any] = [
kTISPropertyInputSourceType as String: kTISTypeKeyboardLayout as String
]
// Get the list of input sources
if let inputSources = TISCreateInputSourceList(searchDict as CFDictionary, false)?.takeRetainedValue() as? [TISInputSource] {
for source in inputSources {
if let layoutName = TISGetInputSourceProperty(source, kTISPropertyLocalizedName) {
layouts.append(layoutName as! String)
}
}
}
return layouts
}
// Example usage
let keyboardLayouts = getAvailableKeyboardLayouts()
print("Available Keyboard Layouts:")
keyboardLayouts.forEach { print($0) }
Alternative solution
No response
The text was updated successfully, but these errors were encountered:
Issue Details
Currently, we rely on the OS language in order to select language-specific filter lists.
This may not be enough. For instance, the user may prefer to use English as the default language by OS, but they could actually be a speaker of a different language.
Proposed solution
In addition to that OS language we need to also rely on available keyboard layouts and extract language codes from it.
Code example to select available keyboard layouts:
Alternative solution
No response
The text was updated successfully, but these errors were encountered: