-
Notifications
You must be signed in to change notification settings - Fork 5
Language
Hossein Pira edited this page Sep 8, 2023
·
3 revisions
To define a language file to folder routes/lang
Go ahead and create a php file with an array inside. Your sample file should be like en.php
<?php
return [
"welcome" => "Welcome",
"home_title" => "Home",
"app_info" => "fast chatbot webApp"
];
And call the model as follows:
$lang = new Lang(); // default en
echo $lang->get('welcome');
To display a variable in the language, start it with :
( Defining its variables is optional and it will be displayed in the same way until you define it. )
<?php
return [
"hello" => "Hello :name"
];
and assign value to the variable as follows:
$lang = new Lang("fa");
echo $lang->get('hello', ["name" => "Hossein"]);
- 1 - Installation
- 2 - Routing And Database
- 3 - HTTP Request
- 4 - CORS
- 5 - Env File
- 6 - Views
- 7 - Language
- 8 - SPA Without API
- 9 - Data Validation
- 1 - Installation
- 2 - Routing And Database
- 3 - HTTP Request
- 4 - CORS
- 5 - Env File
- 6 - Views
- 7 - Language
- 8 - SPA Without API
- 9 - Data Validation