Laravel-Lang / lang

List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark and Laravel UI.

Home Page:https://laravel-lang.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing english JSON and Fortify untranslatable status

thewebartisan7 opened this issue · comments

commented

Why is missing english JSON? If someone want to change the default phrases in english, can be useful to have this already in JSON.

I would like also know how you manage translation of Fortify response since they are not translated when response is not JSON? I propose a commit but was not accepted, here https://github.com/laravel/fortify/pull/101/files

English json: https://github.com/Laravel-Lang/lang/blob/master/script/en/en.json

And for Fortify, I don't know, sorry

@thewebartisan7, Fortify is a package installed into a Laravel application.
For translation files to work, the text must be called using the __() method, otherwise it will not be translated.
Your PR was not accepted, which means these keys will not be translated by the framework itself.

commented

@caouecs thanks, I didn't see it.

@andrey-helldar I know that Fortify is a package for laravel, and I know how to translate using method __().
My PR was not accepted only because is a breaking change.

I explain the problem in my issue here laravel/fortify#100.
Shortly, the problem is that phrases are not like JSON file phrases, but like 'verification-link-sent', and also not like PHP translation array since is missing first part of filename. I can just append it like Taylor suggest, but since this phrases are added in sessions status which is almost always already translated in backend, see https://github.com/laravel/fortify/blob/1.x/src/Http/Responses/SuccessfulPasswordResetLinkRequestResponse.php#L38, also in old laravel ui was already translated, I need to check if phrase is already translated or not, because I have in my main layout globally:

      @if (session('status'))
            {{ session('status') }}
        @endif

I think also others are using globally this session status.

Now I need to add check if translation is already translated and if not, use like Taylor are suggesting "@trans('statuses'.$status)"

Not really ideal.

I see that you have translated Fortify, but all this phrases are not.

I hope that I explain well myself.

commented

Can you add this "label" inside JSON file so that it get translated by community here? Because I am working on a package, and I would like to use only standard solution, not some custom solution like this proposed by Taylor.
In case I can make PR.

This package contains only those translation keys that are available in official Laravel applications.

The solution in your case is to add the necessary translation keys to the <lang>.json file yourself.

You can also use a translation manager such as andrey-helldar/laravel-lang-publisher. It only updates our keys, which you added manually, does not touch.