aboutsummaryrefslogtreecommitdiffstats
path: root/locales/README.md
diff options
context:
space:
mode:
authorsillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
committersillylaird <sillyfanboy@gmail.com>2026-09-03 00:33:59 +0000
commit898b52edcb47bcb3e9d6106e74ca73e74ea01e70 (patch)
tree85c6ee5ad58b860144551184d4cf86b560c62b91 /locales/README.md
downloadwww-898b52edcb47bcb3e9d6106e74ca73e74ea01e70.tar.gz
www-898b52edcb47bcb3e9d6106e74ca73e74ea01e70.zip
import live www.sillylaird.ca webrootHEADmain
Diffstat (limited to 'locales/README.md')
-rw-r--r--locales/README.md24
1 files changed, 24 insertions, 0 deletions
diff --git a/locales/README.md b/locales/README.md
new file mode 100644
index 0000000..5a04920
--- /dev/null
+++ b/locales/README.md
@@ -0,0 +1,24 @@
+# Locales
+
+Flat key → string dicts, one file per language: `en.php`, `ja.php`, `zh.php`.
+Loaded by `partials/i18n.php` via the `t($key)` helper.
+
+**EN is source of truth.** Missing keys in ja/zh fall back to English, then to
+the key string itself. When you add UI strings, add the EN key first and mirror
+it in ja/zh in the same change when possible.
+
+## Migration strategy
+
+The existing `foo.php` / `foo_jp.php` / `foo_zh.php` triples are kept as-is.
+When you next edit a page triple, collapse it:
+
+1. `require_once __DIR__ . '/partials/i18n.php';` at the top of `foo.php`.
+2. Replace the hardcoded English strings with `<?= t('foo.someKey') ?>`.
+3. Add matching keys to `locales/{en,ja,zh}.php`.
+4. Replace `foo_jp.php` / `foo_zh.php` with a one-line redirect stub:
+ `<?php header('Location: /foo.php?lang=jp'); exit;`
+ (or leave them until you're ready to migrate routing).
+
+Language detection reads the current filename's `_jp.php` / `_zh.php`
+suffix, matching the existing URL scheme. No routing changes required to
+start using `t()`.