I18n in javascript using .properties file

I am developing a web application with JSF, so I use the Java properties file (i.e. resource_es_CO.properties) to localize the strings for the application, and this works fine.

Question Mi: how can I call localized strings in such files from my javascript check so that warnings display these localized strings to the user?

Thanks in advance.

+3
source share
2 answers

What I do is send messages as part of the page, fall into hidden tags <span>with "id" values ​​made from property names.

Ajax- .

ajax, , - . (.. , ), . , , , - (, " , " validation.addressForm "") )

: jQuery:

$.get('/fetchProperty', { property: 'firstNameMissing' }, function(propValue) {
  $('#errMsg').text(propValue);
}, "text/plain");

ajax, XMLHttpRequest.

+1

ajax- . jsp. . , , , ajax-. , javascript-

0

Source: https://habr.com/ru/post/1755997/


All Articles