Admin
i18n Localizations
Internationalisation
SynaptikCMS has a two-track i18n system: one for the front-end and one for the admin panel.
Locale files
| Scope | Path | Format |
|---|---|---|
| Front-end | /lang/{locale}.json | JSON key/value |
| Admin | /lang/admin/{locale}.json | JSON key/value |
How it works
On the first request, lang_load() reads settings.json to find active_language, loads the locale JSON, generates an OPcache-friendly PHP cache in lang/cache/{locale}.php, and stores it in $GLOBALS['_LANG_STRINGS'].
The cache is invalidated automatically if the source .json is newer.
JS bridge — inject in header.php:
window.CMS_LANG = ;
URL slugs
Defined per locale, drive routing, URL generation, and the admin simultaneously:
"url_slug_article": "article",
"url_slug_articles": "articles",
"url_slug_project": "project",
"url_slug_projects": "projects",
"url_slug_page": "page",
"url_slug_pages": "pages",
"url_slug_category": "category",
"url_slug_tag": "tag"
Output helpers
_e('new_article'); // Echo
$label = __t('new_article'); // Return
printf(__t('media_files_size'), admin_format_file_size($s)); // Placeholder
Adding a new string
- Add the key/value to every locale file in
/lang/and/lang/admin/as appropriate. - Never hardcode a user-visible string in PHP — always use an i18n key.
Adding a new language
- Copy
lang/en.json→lang/{locale}.json - Copy
lang/admin/en.json→lang/admin/{locale}.json - Translate all values
- Set
"active_language": "{locale}"insettings.json
All code comments and function docblocks must be in English. Only the values inside locale JSON files are translated.
