conedevelopment / i18n

Push your Laravel translations to the front-end and use them easily with JavaScript.
https://pineco.de/using-laravels-localization-js/
MIT License
129 stars 21 forks source link

Allow to parse just a lang sub-directory instead of all lang directory #15

Closed luiscoutinh closed 4 years ago

luiscoutinh commented 4 years ago

Allow to specify a sub directory to parse, instead of parse everything inside the lang folder.

For example, if you have a js directory under lang directory, maybe you just want to parse what is under this directory instead of all lang directory.

iamgergo commented 4 years ago

@luiscoutinh Hey, thank you for your PR!

Please give me some time, until I'll be able to look deeper!

Thanks!

iamgergo commented 4 years ago

I think I'm more of a fan of excluding paths. Also, I think, it should be in a service provider and not in a config file, because we have no other config, it just adds extra complexity on installing/publishing/configuring.

I'll look for a good pattern on how to solve to extend easily the provider.

iamgergo commented 4 years ago

Since we are caching the parsed data, it has no performance concerns if the parsed data is a bit bigger or not. So, it's much easier to filter the data on the front-end and pass that to the JS class's constructor.

Thanks.