PHP code example of webman-tech / laravel-translation
1. Go to this page and download the library: Download webman-tech/laravel-translation library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
webman-tech / laravel-translation example snippets
namespace app\controller;
use support\Request;
class FooController
{
public function bar(Request $request)
{
$message1 = transL('messages.abc');
$message2 = trans_choice('messages.xyz', 2);
$message3 = __('messages.mnl');
return json([
$message1, $message2, $message3
]);
}
}