I've been trying to figure out how to create a custom transform so I can implement it for the Tibetan language.
I know we can do something like this:
import Foundation
let shanghai = "上海"
shanghai.applyingTransform(.toLatin, reverse: false)
// → "shàng hǎi"
And I know I could build a StringTransform using ICU syntax like it was explained here:
But Any
doesn't work for Tibetan.
import Foundation
var mutableString = NSMutableString(string: "ཆོས་")
var stringTransform = StringTransform(rawValue: "Any-Latin;")
var latinText = mutableString.applyingTransform(stringTransform, reverse: false)
//This doesnt work I would liek to have it be --> chos
//The word is actually made out of the following characters:
//0: ཆ U+0F46 TIBETAN LETTER CHA
//1: ོ U+0F7C TIBETAN VOWEL SIGN O
//2: ས U+0F66 TIBETAN LETTER SA
I'm not sure if it is possible to create custom transforms, anyone knows if its possible to view the code for some other transformation like Mandarin to Latin?
https://developer.apple.com/documentation/foundation/stringtransform/1409304-mandarintolatin
Or if this is not possible will I have to create a parser? or anyone has a better Idea.
Thanks for reading.