Language files and localization
How to provide text in modules, skins, and layouts in multiple languages.
Language files: lang/ko.php
Place a PHP file per language code in the module's lang/ folder (ko.php, en.php, ja.php ...).
<?php
$lang->mymodule = '내 모듈';
$lang->msg_title_required = '제목을 입력해 주세요.';
// 배열 형식도 가능
$lang->status_names = [
'open' => '진행중',
'closed' => '마감',
];Format note: The file must be a simple list of $lang->key = 'value'; lines. Do not put function definitions or complex logic in it. The core parses and caches this file.
Using them in code
// PHP
$message = lang('mymodule.msg_title_required'); // 모듈 지정
return new \BaseObject(-1, 'mymodule.msg_title_required'); // 오류 메시지로
// 템플릿 v2
{{ $lang->msg_title_required }}
@lang('mymodule.msg_title_required')- The current module's language file is loaded automatically. To use another module's, specify it as
module_name.keyor load it withContext::loadLang('modules/module_name/lang'). - Skins and layouts can also have their own
lang/folder, loaded in templates with@load('../lang/').
Localizing XML metadata
Write the name and description in info.xml and skin.xml per language with the xml:lang attribute.
<title xml:lang="ko">내 모듈</title>
<title xml:lang="en">My Module</title>
<description xml:lang="ko">설명</description>
<description xml:lang="en">Description</description>The one matching the user's language setting is shown, falling back to the default language if missing.
Localizing user input
Text entered by admins (such as board names) can accept per-language values through the multilingual input widget. When output, passing such values through Context::replaceUserLang($value) replaces them with the current language.
<h2>{{ Context::replaceUserLang($module_info->board_title) }}</h2>Recommendations
- Do not hardcode text in templates; use language keys. Even if you start Korean-only, keeping just
ko.phpmeans adding a language later is just adding a file. - Referencing a key missing from the language file exposes the key name as is. In templates, you can guard against this with
{{ $lang->key ?? 'Default text' }}. - The Zittme core supports 12 languages. For distributed resources, we recommend at least two sets: ko and en.