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

Localization folders error [Laravel 5.5]

Open vvatitv opened this issue 8 years ago • 7 comments

Hello, Sorry for my english, but i have a bug with your generated js.

The problem is that if you have custom folders in your lang folder, this package is not work.

Folder: resources/lang/XX/

Image laravel I have the folder "page" or others.

When i'm generate .JS file, i'm get variables this type:

ru.page.privacy:
  ----
     ---

Image var

which corresponds to the file: resources/lang/ru/page/privacy.php Image phpvar

But, it's not work, when i call function

Lang.get('page.privacy.site.title');

Image function

I have idea, but it's not best, but it's works for me. We need change the file function "getMessages()":

in /src/Mariuzzo/LaravelJsLocalization/Generators/LangJsGenerator.php

and replace 128-130 line in file to: Image changefile

We get the variables:

ru.page_privacy:
  ----
     ---

Image newvar

And now, your package will be work. image good

vvatitv avatar Oct 24 '17 17:10 vvatitv

Can you use the last version 1.4.5 and see if it is fixed?

rmariuzzo avatar Nov 18 '17 18:11 rmariuzzo

Hello, Current version 1.4.6 - not work... Version 1.4.5 - not work...

vvatitv avatar Nov 18 '17 19:11 vvatitv

Thank you for the quick reply, I will investigate. In the other hand, do you use webpack?

rmariuzzo avatar Nov 19 '17 17:11 rmariuzzo

Hello, no, i'm use gulp ;)

84a50dfb0901013f8318358b2b243734

f9092ccd4444e61c962a3acd3c19f36f

vvatitv avatar Nov 19 '17 17:11 vvatitv

Ok, I did a tool for webpack. Will take a look at that issue. Also, will check for a gulp plugin that does this.

rmariuzzo avatar Nov 19 '17 19:11 rmariuzzo

@vvatitv you can try this

Lang.get('page/privacy/site.title');

or

Lang.get('page/privacy.site.title');

for me it work

ivolkoff avatar Jan 24 '18 20:01 ivolkoff

@ivolkoff @rmariuzzo

Yes, it works now! Thanks great.

vvatitv avatar Jan 25 '18 02:01 vvatitv