Okay, so last time tried to translate all of the content from Arabic to English and French. I really wanted to get this working directly from inside Claude Code (using my Max subscription instead of paying for API usage), but whatever -- it didn't work.
Today, we'll fire up a script and get the job done for shizzle.
Translating content using Python
The solution, of course, was to create another script - a la download.py - that translates the content.
This was pretty straightforward -- I just asked Claude Code to do this for me - paying special attention to the long files, since those would need to be processed in smaller bits.
Claude one-shotted this, no problemo.
(I don't have screenshots because I was too tired to document the whole thing; I was basically doing this in between a bunch of errands!)
Translating the UI
Then, I realized that the UI wasn't getting translated.
So heading to http://localhost:3000/en would load up the English content -- but it was all hard-coded inside the files through if statements like so:
<h1>{locale == "ar" ? "...": "locale" == "en" ? ... }</h1>
Ok, that's not going to work.
My dream was to make this so that I can just add a language (e.g. fr for French) and have EVERYTHING get generated using LLMs.
So I had claude code cook something up -- and it did it without breaking a sweat!
It just added a ui.json in the data/ directory that already included all the content, and now we could translate that to ui_en.json, etc. It also introduced an i18n-style t() method that can be used to retrieve the translation values by key.
Next up, transcription of videos!