Two languages, one set of templates
English and Hebrew from the same PHP files, including the right-to-left layout.
The site is published in English and Hebrew, and the two versions are not separate builds. Every page is one file. Text comes from lang/en.php or lang/he.php through a single function that walks a dotted key, so a template asks for hero.title and receives whichever language the visitor chose.
The language comes from three places, in order: a lang parameter in the URL, a cookie remembering the last choice, then English. Hebrew sets dir="rtl" on the html element and a matching class on the body, and the stylesheet carries a block of overrides for the navbar, cards, forms, footer and carousels underneath that class. The layout mirrors. The code does not fork.
Two habits keep it honest. Placeholders such as %s and inline markup are preserved in translation, and a small script compares the two files key by key before release, so a missing string appears as a failed check rather than stray brackets on a live page.
That same script caught a subtler problem. Canonical URLs once ignored the language, which meant every Hebrew page declared the English one as its canonical and asked search engines to ignore it. The fix was small, but it is the difference between publishing a translation and actually offering one.