Category : laravel-localization

laravel localization is working when I don’t set the default locale parameter, if I set it’s not working. it replace the other required parameters. web.php Route::group([ ‘prefix’ => ‘{locale}’, ‘where’ => [‘locale’ => ‘[a-zA-Z]{2}’], ‘middleware’ => ‘Localization’ ], function() { Route::get(‘/’, function () { return redirect(route(‘home’)); }); Route::resource(‘/about’, AboutController::class)->middleware(‘auth’); }); kernel.php protected $routeMiddleware = [ ..

Read more

I’m making a multi-language website using Laravel 8. I have translated the words using {{ __(filexp.wordexp) }} and also having the lang/en file with the words translated. I have stuck at a function which uses {!! !!} function, and I want to translate the word inside the function. <x-jet-checkbox name="terms" id="terms"/> <div class="ml-2"> {!! __(‘By ..

Read more

I’m making a multilanguage web project using laravel 8.0. To make it multi language I used https://github.com/mcamara/laravel-localization package. It works on dashboard, but not in register page. The error was SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpExceptionThe GET method is not supported for this route. Supported methods: POST.. To fix the error I added in <form: LaravelLocalization::getLocalizedURL{} This is the register.blade.php: ..

Read more

I’m working on a multi language web project using Laravel 8.0. I have use the https://github.com/mcamara/laravel-localization package to change the language. Its only 3 main pages which are dashboard, register and login. The package works correctly on dashboard page, but in the register page it shows this: SymfonyComponentHttpKernelExceptionMethodNotAllowedHttpException The GET method is not supported for ..

Read more

I’m building a multi language website using Laravel. To do that I used the https://github.com/mcamara/laravel-localization package. Now I want to save the language as a field at users migrations. This is create_users_table.php: <?php use IlluminateDatabaseMigrationsMigration; use IlluminateDatabaseSchemaBlueprint; use IlluminateSupportFacadesSchema; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public ..

Read more

I using mcamara/laravel-localization package site.com/az/ works properly control.site.com/az doesn’t works (does not display the appropriate language text). There is no any error message. when I check my lang files on view it displays correct messages dump(trans(‘test.greeting’,[], ‘en’),trans(‘test.greeting’,[], ‘az’), trans(‘test.greeting’,[], ‘ru’)); but when I try to use {{ trans(‘panel.note’) }} or @lang(‘test.greeting’) or {{__(‘test.greeting’)}} then displays ..

Read more

In my laravel application, I have a user registration form. Since the application is a multilingual one, I’m trying to translate each and every single text, including the placeholder texts. {!! Form::text(‘first_name’, null, array(‘placeholder’ => ”.{{ __(‘texts.First Name’) }}.”,’class’ => ‘form-control txt_txt’)) !!} {!! $errors->first(‘first_name’, ‘<span class="help-block" role="alert">:message</span>’) !!} When I try to run this, ..

Read more

I’ve been struggling lately with this problem and I really need some help. So I implemented this tutorial: https://youtu.be/KqzGKg8IxE4 for adding localization to my project and it works well for routes that doesn’t require another parameter besides the language. What I want to do is just keep the locale to the url as the first ..

Read more

What is the best logic to separate language files in Laravel? I am about to make a decision out of two choices. First is to collect all application button localization strings in buttons.php, link localization strings in links.php, placeholders localization strings in placeholders.php. Like this : /resources /lang /en buttons.php links.php placeholders.php /es buttons.php links.php ..

Read more

Why I can’t completely switch language in laravel by route. In web.php I wrote: Route::get(‘locale/{locale}’, function ($locale) {session()->put(‘locale’, $locale);return redirect()->back();})->name(‘locale’); My kernel : protected $middlewareGroups = [ ‘web’ => [ AppHttpMiddlewareEncryptCookies::class, IlluminateCookieMiddlewareAddQueuedCookiesToResponse::class, IlluminateSessionMiddlewareStartSession::class, // IlluminateSessionMiddlewareAuthenticateSession::class, IlluminateViewMiddlewareShareErrorsFromSession::class, AppHttpMiddlewareVerifyCsrfToken::class, IlluminateRoutingMiddlewareSubstituteBindings::class, AppHttpMiddlewareLocalization::class, // Our localization middleware ], My middleware localization : namespace AppHttpMiddleware; use Closure; use App; use ..

Read more

I have the following assertion in a feature test: // just a convenience method to post a CSV file $this->importData($postdata, $csv) ->assertStatus(200) ->assertExactJson([ "alert" => null, // response text copied from RoomController::import() "message" => sprintf(__("%d items were created or updated."), count($csv_data)), ]); This passes without issue in PHP 7.4. Without making any changes to my ..

Read more

iam trying to make multilanguage view in laravel i set up everything but when i change the localization in config/app.php from "en" to "ar" … it stays "en" and i tested with the function App::getLocal my files of translation "messages.php" for "en" ”’ <?php return [ /* |————————————————————————– | Authentication Language Lines |————————————————————————– | | ..

Read more