Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vedoj's avatar
Level 1

I can't make the JSON translations work, only the PHP translations work

In my view files i want to use the translation string __("Test Test")

my de.json file:

{
    "Test Test": "from de.json"
}

But it is not working in my view files.

However, in the same directory /lang/de I also have test.php file:

<?php
return [
    'test_test' => 'from test.php',
];

and it is correctly outputting from test.php.

I am using the standard Breeze installation.

Why is that and how to fix it, so I can use the translations I have in de.json file as well.

Thank you in advance.

0 likes
7 replies
baumanma's avatar

To understand you right: You'd like to display the json file through a blade view file?

vedoj's avatar
Level 1

@baumanma I want to display "from de.json" in my views/auth/login.blade.php here:

            <x-primary-button class="ml-3">
                {{-- __("Log in") --}}
                {{ __("Test Test") }}
            </x-primary-button> 
vedoj's avatar
Level 1

@baumanma Why is there de.json if I can't use it? Where does one use de.json?

baumanma's avatar

@vedoj oh, now I get it. You're working with language translation. I was thinking of translation from JSON to PHP-Arry. My bad! Advice from @snapey and @newbie360 down below will do the trick.

Snapey's avatar

don't have both files. use one or the other

newbie360's avatar

your files should look like this...

lang\de.json

lang\en\test.php
lang\de\test.php

Please or to participate in this conversation.