Questions tagged [laravel-localization]

Laravel's localization features provide a convenient way to retrieve strings in various languages, allowing you to easily support multiple languages within your application.

Laravel's localization features provide a convenient way to retrieve strings in various languages, allowing you to easily support multiple languages within your application.

For more information about Laravel's localization functionality, see the official docs.

113 questions
0
votes
2 answers

Laravel - Translate Model public const Array

I have a model with a public const array in it for static values, ie: class StudentStatus extends Model { public const STATUSES = [ 0 => 'Unknown', // Blank & Other entries 1 => 'Active', // Activo 2 => 'Cancelled', // Cancelado 3…
SupaMonkey
  • 876
  • 2
  • 9
  • 25
0
votes
0 answers

Laravel - Translate MySQL CONCAT string with date in Blade

I know I can translate in Laravel using the __ helper function, eg - in my blade template: {{ __("Hello") }} But what happens when I want to mix in variables to that? For example, imagine in my controller I am using MySQL to return a concat string…
SupaMonkey
  • 876
  • 2
  • 9
  • 25
0
votes
2 answers

How to change the language of layouts using the Laravel localization tool?

I'm using Laravel's localization tool to change the language of my application (English and French). The change of language is done thanks to a select in the navigation bar. With the official doc I use the routes, the controllers and the blades to…
Storm28
  • 59
  • 2
  • 10
0
votes
1 answer

How can I use Laravel localization inside blade components

Inside my blade I have different components were someone are used in multiple blades so they need a different text. In my case my component has an attribute "title" were is different in the different blades that I use it. Component:
0
votes
2 answers

how to fix htmlspecialchars(): Argument #1 ($string) must be of type string, array given on laravel 9

I changed the string in post.php in laravel (lang) directory, to change the language on the website from 'search' => 'Search here...' To 'search' => [ 'placeholder' => 'Search here...', 'null' => 'Data not found' ], after that an error occurs with…
Wildan Maulana
  • 62
  • 1
  • 1
  • 8
0
votes
0 answers

Laravel edit function UrlGenerator locale

I am making a multilingual site on Laravel 9, I have multilingual routes ru.home uk.home en.home Based on them, the correct locale is displayed, everything works. But, instead of writing in each template {{ route(app()->getLocale().'home') }} I…
0
votes
1 answer

Localization not working in laravel 8 with json file

I am trying to implement multiple languages in my laravel application with json files in resource/lang/ directory with shortnames of languages i.e en.json, ar.json. Following is the code web.php Route::get('lang/{lang}',…
HAMZA HUMMAM
  • 309
  • 1
  • 2
  • 9
0
votes
2 answers

How to add a default parameter for all routes in laravel

I have a multi lingual website. where i want to add current locale as prefix for all of my project routes. For that to be than any time i use a route i must always provide a value for locale parameter of the route. I think there are better ways of…
0
votes
1 answer

laravel localization set the default locale parameter replacing other parameters

I am new to laravel. when I set the default locale from localization.php and I click on any of my data list edit buttons it replaces the id variable to locale value like (en/ ur/ sd). then I remove the default locale parameter from…
azhar
  • 351
  • 3
  • 13
0
votes
0 answers

Why is shows to me "Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException The GET method is not supported for this route."

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…
ingjo12
  • 45
  • 6
0
votes
1 answer

How to set Laravel fallback locale dynamically?

I try to set fallback locale dynamically through web using config set with the key of app.fallback_locale. But its did not work. config()->set('app.fallback_locale', 'ms') Is there something I missing?
0
votes
1 answer

laravel localization does not work with paramters

I have a multilingual project with English and Persian languages, While Persian is configured as locale for my project. localization files under lang directory in resources for both languages works fine except for parameters that I define. under…
Mohsen Amani
  • 82
  • 1
  • 8
0
votes
0 answers

How to get the id from json file and display in view laravel for translations

I want to get the id from my messages.php file e.g: "apple": "Apple is..", "pear": "Pear is..." and display it in my view dynamically, getting the page's id from my json file. For example I want to do something like this, but it won't work: {{…
kukri
  • 93
  • 1
  • 8
0
votes
1 answer

Laravel language translation error with place holder texts

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' =>…
0
votes
2 answers

Laravel language file separation logic

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…
gurkan
  • 3,457
  • 4
  • 25
  • 38