1

I am trying to implement multi language support on laravel. I have other language like korean and spanish inside ko.jso and es.json files. BUt the problem is if I include en.json. It won't be detected by laravel. It uses the default string found in my code instead of using the value inside the en.json file. How do I force laravel to use the en.json file on my translation folder?

On my translation en.json file it has something like this.

{"2117-Company Information": "Company Information"}

on my code I did it like this:

__('2117-Company Information')

I outputed the current language that I am using, using this code

dd(App::getLocale()); // Output "eng"
Yves Gonzaga
  • 135
  • 1
  • 3
  • 16

1 Answers1

1

Thanks all I found the issue

The first problem was my file name was "en.json" instead of "eng.json"

Second is I have number key on my eng.json file like

{
"1000": "test 1",
"1001": "hello world",
"1002": "awesome world",
..... 
 "2000": "test word 2000"
}

when I try to use the key "1000" it outputted the value for key "2000." I think it is a bug. but I replace all my keys into something like this

{
"1000-test 1": "test 1",
"1001-hello world": "hello world",
"1002": "awesome world",
..... 
 "2000-test word 2000": "test word 2000"
}

It works perfectly on my end

Yves Gonzaga
  • 135
  • 1
  • 3
  • 16