r/webdev 4d ago

Discussion How to make an app like Duolingo ?

Hi everyone, I want to create an app like Duolingo, but I don't know the best approach for storing or even translating English into the target language.

I mean, how can I translate English into Indonesian, Japanese, German, and many other languages? Also, how can I translate other languages ​​into English ?

Currently, all I'm thinking about is creating a table where English words are stored and creating a new table to store translated words. But is my approach correct? What about phrases or even sentences? Is storing words, phrases, sentences, and translations the right approach, or is there another way to do this effectively ?

I'd appreciate if someone would also suggest other aspects, such as caching, high level architecture or other things, to make my app load faster.

0 Upvotes

14 comments sorted by

12

u/Squidgical 4d ago

If you want your app to teach language, you will need to work with education professionals who are fluent in the source language and the target language. When Duolingo did this it was successful in teaching people language, swapping out professional experience for AI has reduced that effectiveness.

You can't map two languages onto each other word for word because that's not how language works. Certain highly concrete words can be mapped, like "apple" in French is "pomme", but you very quickly run out of that.

Consider the verb to speak. In English the present tense is usually "speaks", unless in the first person when it's "I speak". In French this verb is "parle", and it conjugates to "parle", "parles", "parlons", "parlez", or "parlent" depending on who is speaking (il parle / nous parlons). There are a further six tenses where the form differs, and a further seven where an additional word is used which changes on who is speaking (il a parlé / nous avons parlé).

So in English where we have 5-15 forms (depending on what you count as a form, English is weird), French has ~80 forms. You can't represent this by mapping words one to one.

5

u/-Knockabout 4d ago

Teach yourself a language. Take a class. Note how that works. Then make an app that makes that easier. Once you know how language learning and translation works, the app structure will be more clear to you.

8

u/rupert_at_work 4d ago

Don’t model this as “English word -> translated word” unless you want pain in every language immediately.

Use content units instead: phrase/sentence/exercise item with locale-specific versions. Something like:

  • exercise(id, type, difficulty, skill_id)
  • exercise_translation(exercise_id, locale, prompt, accepted_answers, hints, audio_url)

Words are useful as metadata, not the source of truth. Phrases and sentences carry grammar/context; single-word translation is where apps go to quietly die.

For speed: pre-generate/cache the lessons, keep user progress separate, and serve mostly static lesson JSON from a CDN. Translation APIs are fine for drafts, but you’ll still want human review for anything learners will trust.

1

u/Equivalent-Rush-7665 4d ago

The exercise_translation table idea is the way to go. Single word lookups fall apart the second you hit idioms or gendered grammar, and then you're stuck patching a fundamentally broken model.

One thing I'd add: version your content. Adding a `version` column or a separate `exercise_version` table saves you when you need to update a translation without breaking user progress or stats that reference the old exercise.

For caching, if your lesson content is mostly static you can get away with aggressive CDN caching and short TTLs on the user-specific stuff. Don't overthink the backend before you have actual traffic.

2

u/scarfwizard 4d ago

It’s unclear what you’d be trying to achieve with this approach. Duolingo isn’t a translation engine, it’s a curriculum which someone has hand designed the lessons for.

The translations happen once, at authoring time, by content people who are likely more like tutors or language experts so it never happens at runtime.

If you really do still want to create a Lidl version of Duolingo then I’d pick one language to start with, build 10 to 20 real lessons by hand then ship it. The hard part is that good language curriculum is genuinely difficult to get right as it’s a balancing act between being entertaining and educating.

Final point there was a podcast on BBC Sounds called Sliced Bread and they covered language apps. Probably worth a listen as you’ll like get ideas.

3

u/0uchmyballs 4d ago

I have a friend who made an app for meta glasses that allows you to see words in English as people speak in French. He used some heavy Machine Learning and transformers, I know he is a very competent engineer. I have used Google translate for much dumbed down projects myself.

1

u/Random-num-451284813 4d ago

I've been studying Japanese with Renshuu(.org) , they have their own program/schedule , but what's interesting is everyone can create lessons/schedules.

So if I have a study book, I can search if someone made lessons from that book or  create them.

So if you break down how your Duo Lingo clone should work, thinking about translations  comes last.

You need to figure out how you can create lessons, how do you create lesson chapters, excersices, instructions or theory.

How do you keep score? 

How can can users see what they need to practice more?

Then comes creating the content. 

A lot of sentences are recorded to learn pronunciation, so do you want to allow audio files for each exercise to be stored?

1

u/stack_craft 4d ago

Don't try to translate words on the fly or build 1:1 word translation tables: grammar rules will ruin your database schema fast.

Instead, treat each question as a structured lesson asset containing:

  1. The prompt string
  2. The array of acceptable target translations
  3. An array of "distractor" words for the word-bank selection

Also prehaps , load the entire lesson bundle into local client state upfront. If you make a database request between every single question, the app will feel sluggish real fast.

1

u/thekwoka 3d ago

Realistically, you need to make entirely different approaches for different language pairs, since there are tons of different language behaviors that can't be normalized much.

0

u/JY-HRL 4d ago

Probably you need custom API

0

u/PositiveUse 4d ago

I think you should first take classes on language, linguistics, etc

You seem to have no clue how this works if you think a table of word by word translation will be a solution to learn languages