Accessibility
AI language switcher: five South African languages, translated live, cached forever
South African sites are usually English-only because translation projects are expensive, go stale, and require duplicate content management. GoGee's language switcher removes all three problems by translating the rendered page on demand and caching the result.
It supports English, Afrikaans, isiZulu, isiXhosa and Sepedi. There is no duplicate site to maintain, no translation vendor in the loop and no separate URL structure to manage.
GoGee feature series · 8 of 33
How it's actually built
- Languages
- English, Afrikaans, isiZulu, isiXhosa, Sepedi
- Model
- google/gemini-2.5-flash-lite
- Caching
- In-memory map plus versioned local storage per language
- Batching
- Unique strings in chunks of 50, sent in parallel
- Live content
- Mutation observer, 200ms debounce
- Failure mode
- Original text is kept, never blank
- 01Input
Rendered page text
Strings collected from the live DOM
- 02Deterministic
Deduplicate and batch
Unique strings in chunks of 50
- 03AI
Translate
gemini-2.5-flash-lite, chunks in parallel
- 04Database
Cache
In-memory map plus versioned local storage per language
- 05Output
Live swap
Mutation observer with 200ms debounce keeps new content translated
Guardrails and fallbacks
- English, Afrikaans, isiZulu, isiXhosa, Sepedi
- Original text kept on failure, never blank
AI language switcher, real translation, data flow, generated from the shared GoGee feature diagram template.
How the page is translated
The switcher walks the live DOM and collects text nodes, skipping scripts, styles, code and pre blocks, SVG, images and form fields, plus anything inside an element marked as no-translate or editable. Unique strings are batched fifty at a time and sent to a server function.
The model receives numbered lines and is instructed to preserve numbering and whitespace and to leave brand names, URLs and numbers alone. The numbered response is mapped back onto the page. If a batch fails or cannot be parsed, the original text stays, a partially translated page is always better than a broken one.
Cached twice, so it is only paid for once
Translations are cached in memory for the session and in versioned local storage keyed by language and source string. A returning visitor switching to isiZulu on a page they have seen before pays no AI cost and sees no delay.
When storage fills up, the oldest half of the cache is evicted rather than the whole cache being dumped. The chosen language is also persisted, so it survives navigation and return visits.
- Per-string caching means shared UI copy is translated once site-wide
- Versioned cache keys allow a clean invalidation when copy changes
- Language choice persists across pages and sessions
Dynamic content keeps up
A mutation observer watches the page body with a short debounce, so content that arrives after the initial render, search results, loaded product lists, modals, live pricing, is translated as it appears rather than sitting in English inside a translated page.
This is the failure mode of most script-based translation add-ons, and it is the reason we built this rather than dropping in a widget.
What you control
Anything you must not have translated, legal names, product codes, trademarks, addresses, is marked no-translate and left untouched. Because translation is applied to the rendered page, you keep one set of content, one URL structure and one SEO strategy.
For sites that need indexed multilingual pages rather than on-demand switching, that is a different build and we will tell you so honestly rather than pretending a live switcher is a substitute.
Questions we get asked
Is this Google Translate?
No. It runs on our own AI pipeline through our gateway, with prompt rules that protect brand names, numbers and URLs, and with our own caching layer.
Does it slow the site down?
First translation of a page costs one batched AI round-trip; after that it is served from cache. English visitors never trigger it at all.
Can we add more languages?
The current set covers five official South African languages. Additional languages are a configuration and testing exercise, speak to us about your audience.
Read next
AI assistant
AI concierge on every site
GoGee's site assistant answers strictly from your published content with validated citations, cached retrieval…
AI search
AI text search, semantic, not keyword
How GoGee's AI text search works: Gemini extracts structured filters, queries are embedded and matched with co…
AI content
AI Content Creator
GoGee's bulk article builder drafts structured articles with a model you choose, generates cover imagery, and …

