I'm working on a Laravel 5.4 project and I need to include specific js script (or any other resource type like image and css) based on user selected language. Currently I use follow syntax:
{!! HTML::script('js/jquery-validation/jquery.validate.min.js') !!}
than correctly include the main js file that is valid for all languages.
The validate plugin show error messages based on user browser language but I want that the language change when the user choose a different language.
So i try:
{!! HTML::script('js/jquery-validation/localization/messages_'){{ Config::get('app.locale') }} !!}
and
{!! HTML::script('js/jquery-validation/localization/messages_') !!}{{ Config::get('app.locale') }}
But both don't work.
The first one throw an exception, the second one produce wrong code
<script src="http://dev-site.me/js/jquery-validation/localization/messages_"></script>
de.js
(obliviously.. because the "locale" part is outside the include declaration.. but I just try.. :P )
so I need a way to create an html like:
<script src="http://yearly-review.me/js/jquery-validation/localization/messages_de.js"></script>
where de.js is a dynamic part based on a variable how can I do this?