File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 14
14
"`%s` is unknow " =>"`%s` n'est pas definit " ,
15
15
"`%s` should be a date. " =>"`%s` devrait être une date. " ,
16
16
"`%s` should be greater than now " =>"`%s` devrait être plus grand que maintenant " ,
17
+ "`%s` should be a string " =>"`%s` doit est une chaine de caractere " ,
17
18
];
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+
4
+ namespace Wepesi \app ;
5
+
6
+ class i18n
7
+ {
8
+ static function translate (string $ message ,array $ data =[]):string {
9
+ $ file ="./lang/ " .LANG ."/language.php " ;
10
+ if (!is_file ($ file ) && !file_exists ($ file )){
11
+ $ file ="./lang/en/language.php " ;
12
+ }
13
+ include ($ file );
14
+ $ message_key =$ message ;
15
+ if (count ($ data )>0 ){
16
+ $ key_value =!isset ($ language [$ message ])?null :$ language [$ message ];
17
+ $ message_key =$ key_value !=null ?vsprintf ($ key_value ,$ data ):vsprintf ($ message ,$ data );
18
+ }
19
+ return $ message_key ;
20
+ }
21
+ }
Original file line number Diff line number Diff line change 16
16
"date_created " =>"2021-05-23 "
17
17
];
18
18
$ valid =new Validate ($ source );
19
- // include "./test/string.php";
19
+ include "./test/string.php " ;
20
20
// include "./test/number.php";
21
21
// include "./test/boolean.php";
22
- include "./test/date.php " ;
22
+ // include "./test/date.php";
You can’t perform that action at this time.
0 commit comments