I wrote a little Laravel web page and I modify often some inputs with jQuery, now I want to implement a multilanguage support. But I dont know how to realize it in jQ.
An example: I have a unsorted list with n items. If the user click on every item I want to display "No more items available" and in German "Keine weiteren Einträge verfügbar". Does somebody have any ideas to realize it?
I using Laravel Blade, the JS content is in a seperated javascript.js file located.
I wrote a little Laravel web page and I modify often some inputs with jQuery, now I want to implement a multilanguage support. But I dont know how to realize it in jQ.
An example: I have a unsorted list with n items. If the user click on every item I want to display "No more items available" and in German "Keine weiteren Einträge verfügbar". Does somebody have any ideas to realize it?
I using Laravel Blade, the JS content is in a seperated javascript.js file located.
Share Improve this question asked Mar 30, 2016 at 7:40 Philipp NiesPhilipp Nies 9694 gold badges21 silver badges40 bronze badges1 Answer
Reset to default 8You could add the translations in your html page. Example:
<!-- Somewhere in your blade template -->
<script>
window.translations = {
noMoreItems: '{{ trans('get.your.translation.here') }}',
somethingElse: '{{ trans('get.your.other.translation.here') }}',
};
</script>
Then use those from your script. You might want to provide some defaults when using. Example:
// jQuery script
var translations = {
noMoreItems: window.translations.noMoreItems || 'My default translation',
somethingElse: window.translations.somethingElse || 'My default translation',
};
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745133320a4613078.html
评论列表(0条)