#Blade Mustache translation in case of subfolders

12 messages · Page 1 of 1 (latest)

haughty socket
#

Hi everyone!

Consider a lang resources tree like this one:

lang
    en
        personas
                  index.php
    fr
        personas
                  index.php

or this other one:

lang
    personas
              en
                    index.php
              fr
                    index.php

None of these tree seem to work with none ofthese Blade template instructions:

{{ __('personas\index.title') }}
{{ __('personas/index.title') }}
{{ __('personas.index.title') }}

Indeed, I face the following problem: personas\index.title, for example, is shown in the browser, instead of the value indicated either in English, or French.

How could I make it work please?

lost lintel
#

What's ur Laravel version ?

#

Because they changed the folder structure for the lang folder at v9

#

Is your lang folder at root ?

#

Why you don't try ```
lang
en
personas.php
fr
personas.php

haughty socket
#

@lost lintel thank you for your answer; I edited the OP, replacing my_file.php with index.php. In fact your solution would work fine, but the only file you have is personas.php, not personas/index.php, which is associated to the "read" CRUD operation that lists all the Personas Eloquent model.
I would have also personas/create.php, personas/edit.php, personas/show.php and personas/delete.php.
Indeed, I prefer to separate the translation by views/CRUD operations 🤔

That's why I need a subfolder personas that would contain index.php, edit.php, etc ^^

So even if your solution works, it doesn't totally satisfy my needs

lost lintel
lost lintel
#

You should make a try with the structure I said just to be sure the issue does not come from your file. Then you'll be sure the issue comes from the path/folder structure.

obsidian pond
#

Don't treat i18n as CRUD.

haughty socket
#

@obsidian pond @lost lintel ok Thank you😁