Skip to content

lets-qa/mrhappy-i18n-harness

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mr Happy – Multilingual Login/Register Harness

This is a pragmatic i18n test harness for a bilingual/ multilingual website. It mirrors a Login/Register view and lets you switch languages with a selector. Preference is persisted in a cookie and respected on next visit.

Features

  • Languages: English (en), Spanish (es), Japanese (ja), German (de), French (fr).
  • Preference order: ?lang=xx query > lang cookie > Accept-Language header > en.
  • Accessible tabs, semantic HTML, zero dependencies.
  • PHP arrays for translations; add new languages under i18n/<code>.php.

Quick start (Docker)

# Build image
docker build -t mrhappy-i18n .

# Run container on http://localhost:8080
docker run --rm -p 8080:80 mrhappy-i18n

Or with Compose:

docker compose up --build
# open http://localhost:8080

Local (no Docker)

You only need PHP:

php -S localhost:8000 -t .
# open http://localhost:8000

Adding a language

  1. Copy i18n/en.php to i18n/it.php (for example).
  2. Translate values in $T and save.
  3. Add the language code to $SUPPORTED in index.php.
  4. Add a lang.name.it entry in all language packs for proper display name.

Notes

  • Demo only: forms do not submit/ store data.
  • Cookie: lang, Lax, TTL 365 days.
  • Fallback prioritizes explicit URL ?lang= over cookies to make demos deterministic for stakeholders.

Files

index.php
i18n/
  en.php es.php ja.php de.php fr.php
Dockerfile
docker-compose.yml
README.md

About

mrhappy-i18n-harness

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors