diff --git a/README.md b/README.md index 0a53fa2..37ce84d 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,12 @@ Internationalization Extension for Mecha Release Notes ------------- + + +### 1.1.0 + + - Added ability to load custom translation items from third party layout and extensions by storing the translation items data in `.\lot\layout\language` or `.\lot\x\*\lot\language` folder. + ### 1.0.1, 1.0.2, 1.0.3 - Added more translation items. diff --git a/language/about.page b/language/about.page index 36726bc..ca0ecd2 100644 --- a/language/about.page +++ b/language/about.page @@ -3,7 +3,7 @@ title: Internationalization description: Set language phrases automatically based on the current `language` state value. author: Taufik Nurrohman type: Markdown -version: 1.0.3 +version: 1.1.0 ... Translation data will be focused on the `.\lot\x\language\state\id.php` file. If you want to contribute, be sure to follow the data in that file. diff --git a/language/index.php b/language/index.php index 263d4d8..db318e7 100644 --- a/language/index.php +++ b/language/index.php @@ -1,10 +1,29 @@ language . '.php')) { +$id = $state->language; +$files = []; + +// Queue default translation item(s) from this extension +if (is_file($file = __DIR__ . DS . 'state' . DS . $id . '.php')) { + $files[] = $file; +} + +// Queue custom translation item(s) from third party extension(s) +foreach (glob(__DIR__ . DS . '..' . DS . '*' . DS . 'lot' . DS . 'language' . DS . $id . '.php', GLOB_NOSORT) as $file) { + $files[] = $file; +} + +// Queue custom translation item(s) from third party layout +if (is_file($file = __DIR__ . DS . '..' . DS . '..' . DS . 'layout' . DS . 'language' . DS . $id . '.php')) { + $files[] = $file; +} + +// Load and merge translation item(s) from queue +foreach ($files as $file) { $data = (function($f) { extract($GLOBALS, EXTR_SKIP); return (array) require $f; - })($f); + })($file); // Automatic lower-case mode foreach ($data as $k => $v) { $kk = strtolower($k); diff --git a/language/state/id.php b/language/state/id.php index 92deb48..d2ba57d 100644 --- a/language/state/id.php +++ b/language/state/id.php @@ -234,6 +234,7 @@ 'Folder %s successfully updated.' => 'Folder %s berhasil diperbarui.', 'Invalid %s format.' => 'Format %s tidak valid.', 'Invalid token.' => 'Token tidak valid.', + 'Invalid user or pass.' => 'Pengguna atau kunci yang Anda berikan tidak valid.', 'Logged in.' => 'Berhasil masuk.', 'Logged out.' => 'Berhasil keluar.', 'Maximum file size allowed to upload is %s.' => 'Ukuran berkas maksimal untuk diunggah adalah %s.',