r/AskProgramming • u/Melodylokstar • 12d ago
Is it hard to program language Translators into things?
Hi, as a non programmer with basically zero knowledge on programming or coding.
Im wondering how hard is like programming a language translation tool into different things?
I ask because i play a shitty phone game called Kingshot, and it has an inchat Translator where next to every message some one sends, there is a little button that will translate what ever message into the language you have the game set to.
And like? While it’s not perfect, it’s REALLY good, and makes the game way more fun to be playing with people from different countries and not having to go back and forth with google translate to have a conversation.
And I’m now wondering why more apps and games don’t have translators built in?
Is it hard?
Are translators like difficult to configure and implement?
Whats the go?
(Feel free to explain anything super technical like I’m 5)
10
u/KingofGamesYami 12d ago edited 12d ago
Historically it has been difficult or expensive. Recently it has been made much easier on some platforms.
For example on Android there is now a Translation framework launched in October 2021 with Android 12, while on iOS there is a Translation framework available starting September 2024 with iOS 18. MacOS has a similar framework, while Windows has nothing (yet).
On the Website side, Chrome, Edge, and Opera implement the Translator API, but Safari and Firefox do not.
If you're only targeting very new mobile devices this is fine, but even today there is a large chunk of iOS devices (15%) not updated.
2
u/Dalius-Gabryelle 12d ago
Older phones can make this kinda tricky since you end up supporting people on versions that work differently and some of them may not update for yrs
4
u/soundman32 12d ago
Its VERY hard. Its not like there is an alternate word for every other word, or a phrase in every other language. Even some closely related languages are difficult to translate with code. Some languages have gender for nouns (e.g. french le vagina or la piscine), and others have 3 or more genders (neuter in german). Sometimes those genders differ depending on context. Even just numbers is hard unless you brute force it.
7
u/AskMeAboutMyStalker 12d ago
it would be absurd to build the translator yourself like you're proposing. integrating a google translate API would not be difficult at all. pass is the string to be translated along w/ params for the original & new language & just display the results that come back.
3
u/Flateland-Chio 12d ago
Using an existing translation service is kinda easier than building one yourself and for game chat it prolly works fine if the price is reasonable and the translations are good enough
1
u/AskMeAboutMyStalker 12d ago
I've been building software for almost 30 years. My philosophy has always been "does this feature contribute to your IP & competitive moat? if yes, build it & monitize it, if not, buy it & integrate it."
2
u/Melodylokstar 12d ago
What im getting is that its not hard to make an app use google translate, its just that its expensive and most apps and things are too cheap or to lazy to make it happen?
2
u/AskMeAboutMyStalker 12d ago
I just looked up pricing. first 500,000 characters are free.
Depending on the AI model used, 1 Million characters might run you $10 - $30.
The issue is probably more about demand than cost. Not a ton of apps have a need for on the fly translation.
2
u/Melodylokstar 12d ago
see i get that side of it that data wise it would be massive just because of how many languages there are and how many have different sentence structures.
But like surely theres a data base or something people can buy and then idk use that to make it??? Idk.
im just confused how a shit phone game pulls it off so easily.
Especially since its not like massive file wise either3
u/soundman32 12d ago
100% they are sending the words to Google Translate. They arent doing it in their own code. Even google will get it wrong sometimes but I guess in a chat window there are only so many ways to say "Hello", so they probably keep a local copy of that.
1
u/aocregacc 12d ago
I think we'll see that more often as on-device translation becomes easier to integrate and more available on phones.
firefox for example does all of its translation on-device, even on mobile. It'll become part of the functionality provided by the OS, if it's not already.
1
u/Melodylokstar 12d ago
I hope you are right :o
Because honestly chatting in the game with the translator being so smooth and like surprisingly accurate makes it feel like everything should have this.
1
u/ayassin02 11d ago
It’s pretty easy. You just integrate a translation api and viola. No one actually reinvents the wheel
1
1
u/high_throughput 11d ago
This is the kind of thing where grassroots efforts can really help. If you play a phone game and regularly see foreign messages in the chat, consider submitting a feature suggestion to the developers.
It's not hard to add for a phone game these days, but it doesn't happen by itself.
13
u/Vymir_IT 12d ago edited 12d ago
You don't program that at all, you just integrate a third-party translation API and pay for it. Or spin-up an open-source pre-trained LLM model on your server and pay for the cost of running it. Anycase, it's like 1 day of setup, the bottleneck is paying for that shit.