Laravel - I18n

laravel

How can we do localization with Laravel?

View::make('home')->width('newMessagesCount',1)
{{ trans('greetings.hello') }}
{{ Lang::get('greetings.hello') }}
{{ Lang::get('greetings.hello', array('username' => $username)) }}
{{ Lang::choice('messages.new', $newMessagesCount, array('count' => $newMessagesCount)) }}

where greetings is the name of the language file and hello is the key. Laravel keeps the language files in the app->lang folder. Each language file is a PHP file with just one statement that return a hash.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License