Inspiration
Someone who has just moved to Japan opens the mailbox and finds a city notice, a tax form and a school letter, all in formal Japanese. A translator app gives them words, but the question they need answered is practical: what is due, when, and what do I bring? I am a university student studying foreign languages, and I wanted to build a prototype whose entire demo is that one moment, a letter turning into a short list of things to do.
What it does
You pick your language, upload a photo of a letter or paste its text, and press "Read it". The screen shows three things: the letter rewritten in plain Japanese (short sentences, simple words, mostly hiragana), a translation into your language (eight are built in), and at most three actions with deadlines. When a letter gives no deadline, the page says so rather than guessing. Plain Japanese and your language are side by side, so a Japanese helper can look at the same screen and confirm the key point with you.
The core demo takes about thirty seconds: choose "Try a sample letter" and a municipal health-insurance notice becomes "Pay 12,400 yen by December 15; bring the slip from the envelope; pay at a bank, convenience store or ward office." The page works without any key in demo mode, and with a Gemini API key it reads real letters.
Check against the original. A fourth panel lists every amount, date, time and phone number in the letter with ✓ (still in the plain Japanese and the to-do list) or ⚠ (missing). A date or an amount that the output has but the letter does not is also marked ⚠, because the model may have invented it. This panel uses no AI: check.js applies fixed rules after normalizing full-width digits and kanji numerals (一万二千五百円, 十二月二十五日, 午後3時). For a photo, Gemini also returns a word-for-word transcription, and the check runs against that.
How we built it
One HTML page plus a small rule file (check.js), with no build step and no backend. One request to gemini-3.5-flash sends the photo and a system prompt, and a JSON response schema (easy, native, todo[{what, when, note}], original) forces the answer into a shape the page can render. The key lives only in the browser tab's session storage. The interface switches between Japanese and English, and the code is published under the MIT license with a README so another team can run or adapt it in a minute.
Challenges we ran into
The core feature has to be trustworthy, not just impressive. The first problem was inventing details: a model asked to "summarize the letter" will happily fill gaps, so the prompt forbids anything not in the letter and defines the exact wording for a missing deadline. The second was making the demo followable by someone who has no key and no time, which is why the page has an offline demo mode with prepared results in English, Simplified Chinese and Vietnamese. The third was keeping the prototype small enough that every part of it could be tested by hand in one sitting.
Testing
A wrong deadline or amount is the most expensive mistake this app can make, so the tests target exactly that. tests/letters.json has twelve letters of the kinds people bring to an international-exchange counter (health insurance, resident tax in four installments, a school trip, a pension notice, bulky-garbage pickup, a health check, a garbage-day change), each paired with a model output. Five outputs are wrong on purpose: three tax installments dropped, a rain date dropped, a deadline invented for a letter that has none, 12,400 yen copied as 1,240, a phone number left out. node --test (16 tests) requires the checker to flag exactly those and nothing in the seven correct outputs. A browser test (Playwright) runs the page with the Gemini reply mocked and checks the panel for pasted text, a photo and the demo. Writing the cases set the scope of the rules (real letters use kanji numerals, full-width digits and 午後 times), and they are why the schema gained the original field: without it a photo could not be checked at all.
What the check cannot do: it catches a dropped or changed number, not a wrong meaning ("pay" translated as "you will be paid" passes), and for a photo it compares with Gemini's own transcription, so a digit misread from the photo is not caught. Pasting the text avoids the second problem.
Accomplishments that we're proud of
- A working core feature end to end: image in, three useful panels out.
- Two readers on one screen: the person and the helper beside them.
- No server, no account and no cost beyond the user's own API usage.
- A demo that anyone can run from the public repository without setting up anything.
What we learned
Constraining the output format and saying explicitly what the model must not do mattered more than clever prompting. I also learned to build the demo path first: once the sample letter produced the right screen offline, every later change to the live Gemini path could be compared against a known good result.
What's next
Add furigana and read-aloud, more languages, a follow-up question box, and a trial at a city international-exchange counter and a school, where real letters will show what the next iteration should fix.
Built With
- css
- gemini-api
- google-ai-studio
- html
- javascript