-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestLangIntegration.php
More file actions
49 lines (36 loc) · 1.6 KB
/
TestLangIntegration.php
File metadata and controls
49 lines (36 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
use Yohns\Core\Config;
use Yohns\Lang\Text;
require_once 'vendor/autoload.php';
echo "=== Testing Lang\\Text Integration with Config ===\n\n";
// Initialize Config for application configs
$configDir = __DIR__ . '/lib/Config';
new Config($configDir);
echo "1. Testing English language:\n";
$langDir = __DIR__ . '/lib/Lang';
$text = new Text($langDir, 'en');
echo " - welcome: " . Text::L('welcome') . "\n";
echo " - goodbye: " . Text::L('goodbye') . "\n";
echo " - hello_name with replacement: " . Text::L('hello_name', [':name' => 'John']) . "\n";
echo "\n";
echo "2. Testing Spanish language:\n";
$textEs = new Text($langDir, 'es');
echo " - welcome: " . Text::L('welcome') . "\n";
echo " - goodbye: " . Text::L('goodbye') . "\n";
echo " - hello_name with replacement: " . Text::L('hello_name', [':name' => 'Juan']) . "\n";
echo "\n";
echo "3. Testing fallback to English:\n";
echo " - items_count (not in Spanish, should fallback): " . Text::L('items_count', [':count' => '5']) . "\n";
echo "\n";
echo "4. Testing auto-update feature (missing phrase):\n";
echo " - new_phrase (should be added to en.php): " . Text::L('new_phrase') . "\n";
echo "\n";
echo "5. Testing runtime set():\n";
Text::set('custom_message', 'This is a custom message');
echo " - custom_message: " . Text::L('custom_message') . "\n";
echo "\n";
echo "6. Verifying Config still works for regular configs:\n";
echo " - siteName from config.php: " . Config::get('siteName', 'config') . "\n";
echo " - users from db_tables: " . Config::get('users', 'db_tables') . "\n";
echo "\n";
echo "=== Integration Test Complete ===\n";