Laravel-JS-Localization icon indicating copy to clipboard operation
Laravel-JS-Localization copied to clipboard

Using default keyed translations

Open samsch opened this issue 8 years ago • 9 comments

It appears that translations in a resources/lang/en.json file (used for translations keyed by the default text) are ignored by the generator.

samsch avatar Aug 09 '17 17:08 samsch

We don't yet support JSON files yet 😞 . Planning to add for version 1.5.

rmariuzzo avatar Aug 09 '17 17:08 rmariuzzo

Are there any Ideas yet, how to integrate? I need this and would add a PR.

okaufmann avatar Oct 17 '17 13:10 okaufmann

I started with a experimental version here: https://github.com/rmariuzzo/Laravel-JS-Localization/pull/116

okaufmann avatar Oct 17 '17 14:10 okaufmann

Is this feature not available yet? This is an indispensable feature for whose working with Laravel 5.4 and above.

maxalmonte14 avatar Jan 06 '18 16:01 maxalmonte14

Will take a look and address this soon.

rmariuzzo avatar Jan 06 '18 19:01 rmariuzzo

Hi I noticed an experimental version merged into develop, is it going to be released soon?

mojtabaahn avatar Sep 26 '19 21:09 mojtabaahn

I don't know if I understand the problem correctly but maybe #147 is also a fix for this?

TheNewSound avatar Apr 21 '20 04:04 TheNewSound

My test case (and personal context/knowledge) for this is long gone with a previous job at this point, but maybe someone else who ran into this can verify?

samsch avatar Apr 21 '20 12:04 samsch

Hi everybody, I found out that the keyed translation strings are actually stored in the messages.js file. The only problem is that they are not found properly by Lang.get.

A quick fix is to use this snipped.

export default class myLang {
    static get(key){
        if (Lang.has('strings.' + key))
            return Lang.get('strings.' + key);
        else
            return key;
    }
}

and use for example myLang.get('Dashboard'),

blaab2 avatar Nov 08 '20 17:11 blaab2