-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT][TRA] add tranlate class module
- Loading branch information
Showing
13 changed files
with
65 additions
and
42 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,5 +18,7 @@ | |
"Wepesi\\app\\":"src/" | ||
} | ||
}, | ||
"require": {} | ||
"require": { | ||
"php": ">=7.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
require_once "./vendor/autoload.php"; | ||
include('./shared/global.php'); | ||
include('./test/index.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
$language=[ | ||
// "hello"=>"hello" | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
$language=[ | ||
"`%s` should have minimum of `%s` caracters"=>"`%s` doit avoir un minimum de `%s` caracteres", | ||
"`%s` should have maximum of `%s` caracters"=>"`%s` doit avoir un maximum de `%s` caracteres", | ||
"`%s` this should be an email"=>"`%s` doit etre un email", | ||
"`%s` this should be a link(url)"=>"`%s` doit avoir un lien(url) ", | ||
"`%s` should match %s"=>"`%s` doit correpondre a `%s`", | ||
"`%s` is required"=>"`%s` est obligatoire", | ||
"`%s` should be a string"=>"`%s` doit est une chaine de caractere", | ||
]; |
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
const LANG = "fr"; | ||
|
||
define('WEB_ROOT', str_replace('index.php', '', $_SERVER['SCRIPT_NAME'])); | ||
define('ROOT', str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME'])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
|
||
namespace Wepesi\app; | ||
|
||
class i18n | ||
{ | ||
static function translate(string $message,array $data=[]):string{ | ||
$file="./lang/".LANG."/language.php"; | ||
if(!is_file($file) && !file_exists($file)){ | ||
$file="./lang/en/language.php"; | ||
} | ||
include($file); | ||
$message_key=$message; | ||
if(count($data)>0){ | ||
$key_value=!isset($language[$message])?null:$language[$message]; | ||
$message_key=$key_value!=null?vsprintf($key_value,$data):vsprintf($message,$data); | ||
} | ||
return $message_key; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters