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
3
votes
1 answer

Carbon with Laravellocalization not using correct locale

I am using mcamara/laravel-localization on my project, and I'm having an issue with Carbon not recognizing locale. When I use $event->start_time->formatLocalized('%A %d %B %Y') it always displays English format, even though I get 'de' when I…
Bojan Kogoj
  • 5,321
  • 3
  • 35
  • 57
2
votes
1 answer

Localization in a custom Laravel Package

My service provider of my custom package has the following lines in the boot() method: $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'name'); $this->publishes([ __DIR__.'/../resources/lang' =>…
JanBoehmer
  • 395
  • 3
  • 14
2
votes
0 answers

Laravel - How to translate webpack Javascript files?

So in standard blade templates, you can translate any text by encapsulating them {{__("Hello")}} and it will translate to the applicable locale. You can also do this in any included Javascript in the…
SupaMonkey
  • 876
  • 2
  • 9
  • 25
2
votes
1 answer

Laravel locatization not translating

Okay so in my app.blade.php //.... {{-- Navbar --}} @include('layouts.navbar') …
w3_
  • 64
  • 1
  • 1
  • 14
2
votes
1 answer

Missing required parameter - routes with more than 2 parameters are not working with localization

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…
theospace
  • 77
  • 3
  • 10
2
votes
1 answer

Localization isn't working for all URL in Laravel

I have applied Localization in my Laravel project. But Localization is getting error for some URL. I have two languages buttons en and bn in my head section. while user click any of the language button, the whole site will be converted into that…
2
votes
2 answers

laravel localization with conditions

Can we provide conditions to trans or Lang method other than pluralization ones, so it checks locale & the condition both to provide the required translations For Example: We have some translations in English for Organisation 1. And different…
2
votes
2 answers

Does laravel not detect request locale automatically?

I am learning laravel 5.4 locale chapter. When I write code to test, I get a question. For example, I have two language directories in my resources/lang directory: /resources /lang /en messages.php /zh-CN …
DengDeng
  • 513
  • 2
  • 9
  • 22
2
votes
1 answer

How to force link translation in laravel 4 mcamara

How to get translated(to chosen language) url from named route? (or how to switch language and make Redirect::route(...) to localized link) I use: php Laravel 4 (L4) mcamara/laravel-localization (LaravelLocalization)
2
votes
1 answer

localization image laravel 5

what code should I write for localization in laravel 5 for an image? The following code I used to string ENGLISH lang 'MY NAME', 'registrasi' => ' REGISTRASION' ]; INDONESIA lang …
ardi gunawan
  • 415
  • 2
  • 7
  • 12
2
votes
3 answers

Laravel 5 | Interface 'Illuminate\Contracts\Routing\Middleware' not found

I use Laravel 5. I try, "use Illuminate\Contracts\Routing\Middleware;" to implement "Middleware" as, class Language implements Middleware { // Some Functions } I Get Error as, Interface 'Illuminate\Contracts\Routing\Middleware' not…
2
votes
2 answers

Laravel Set up User Language

I have many controllers and I want to set this code in the all of this(actually all of project), how can i do that? if( !empty(Input::get('lan')) ){ Auth::user()->language = Input::get('lan'); App::setLocale( Auth::user()->language ); }else{ …
Andrew
  • 189
  • 1
  • 4
  • 18
1
vote
0 answers

Conflict between livewire image preview and mcamara / laravel-localization

I am using the livewire image preview temporaryUrl() function It is working fine when I do the command: php artisan…
1
vote
1 answer

Laravel Localization does not return translated string

I can't seem to figure out what I'm doing wrong. I want my application to use "np" as its default locale. So I change the locale key in config/app.php to 'np.' And when I check for the current location in my controller, it returns 'np', so it's…
Sambhav
  • 46
  • 5
1
vote
1 answer

Translation of array attributes from validator

How to translate keys from the validator attributes when it is array? For example: Here is validator with arrays 'image.author' and 'image.book'. $validator = Validator::make($request->all(), [ 'title' => 'required|unique:posts|max:255', …
francisco
  • 1,387
  • 2
  • 12
  • 23