Laravel-JS-Localization
Laravel-JS-Localization copied to clipboard
Using default keyed translations
It appears that translations in a resources/lang/en.json file (used for translations keyed by the default text) are ignored by the generator.
We don't yet support JSON files yet 😞 . Planning to add for version 1.5.
Are there any Ideas yet, how to integrate? I need this and would add a PR.
I started with a experimental version here: https://github.com/rmariuzzo/Laravel-JS-Localization/pull/116
Is this feature not available yet? This is an indispensable feature for whose working with Laravel 5.4 and above.
Will take a look and address this soon.
Hi I noticed an experimental version merged into develop, is it going to be released soon?
I don't know if I understand the problem correctly but maybe #147 is also a fix for this?
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?
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'),