Not ideal :/ The client sends us source language and target language with the string so we just pass these on (if they are different). Language detection happens on device so probably not the highest accuracy model.
nostr:npub18kzz4lkdtc5n729kvfunxuz287uvu9f64ywhjz43ra482t2y5sks0mx5sz I am paying for these translations.

Discussion
nostr:npub1zafcms4xya5ap9zr7xxr0jlrtrattwlesytn2s42030lzu0dwlzqpd26k5 We gotta fix this. 😂
It’s using Apple’s Natural Language API language recognizer to make a prediction. It’ll take the top predicted language if Apple tells us the confidence is at least 50% or higher. Sometimes it gets it wrong. I’ve done a bunch of tweaking and this was the best I could do with their API, but maybe there’s more to be done that I’m not realizing.
Oh, wait. Wtf? On macOS running similar code, it thinks that text is English with 93% confidence, while Norwegian Bokmål is only 4%. Either the iOS language model is messed up or there’s a bug in Damus.

😅🫂
I got down to the bottom of it. I typed in the text wrong. With the ‘ apostrophe, it think it’s English. With the ’ apostrophe, which is what Noshole used, it thinks it’s Norwegian Bokmål with 52% confidence while English is only 41%, which we know is wrong. OK, blame Apple. Maybe we can try to hack it to be smarter such that if your device locale trails the top prediction by X%, we don’t attempt to translate the note.

🕵️♂️🔥
Damnit, Apple. Auto-corrected the first apostrophe when I didn’t want it to. It’s ' versus ’
Punctuation matters!
Happened again. I think what I’ll do is convert from one apostrophe ’ to another ' before running the language recognizer as a bandaid fix to Apple’s incorrect language model. 
Nobody knows I’m Turkish. 😆

OK, I sent the patch to nostr:npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s to review and the fix seems to work on my local iPhone simulator. There should be fewer wasted sats / translation quota.
https://groups.google.com/a/damus.io/g/patches/c/kpfRQ7b1XN8
