✨ Add a way to support parsing translations
This commit is contained in:
parent
329265c030
commit
6f359c5aea
1 changed files with 9 additions and 0 deletions
|
@ -104,6 +104,15 @@ class Language extends dbJSON {
|
|||
echo $this->get($string);
|
||||
}
|
||||
|
||||
public function parse($string, $replacements)
|
||||
{
|
||||
$str = $this->get($string);
|
||||
foreach ($replacements as $key => $value) {
|
||||
$str = str_replace("%".$key."%", $value, $str);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
// Add keys=>values to the current dicionary
|
||||
// This method don't overwrite the current value
|
||||
public function add($array)
|
||||
|
|
Loading…
Add table
Reference in a new issue