I decided to localize the site here, but some points have to do on js.
The question is: You need a regular expression with which you can replace variables in a variable containing an html block with the corresponding variables of the language.
There is a variable containing html code to be displayed on the screen. Here is an example.
<div class="width-250"> <button type="button" class="btn btn-sm btn-primary">{ev_textone}</button> <button type="button" class="btn btn-sm btn-primary">{ev_texttwo}</button> <button type="button" class="btn btn-sm btn-primary">{ev_other}</button> </div> And as you can see in the code, there are language variables that are in braces. There is a language file that is loaded on the page initially. The task is to change curly brackets with variables to the corresponding words or phrases from the language array.
var lang = { ev_textone: "Это поле не должно быть пустым", ev_other: "Длинна этого поля должна быть от 5 до 30 символов", ev_texttwo: "Максимальная длинна этого поля 255 символов", ev_dateright: "Введите дату и время в формате ДД-ММ-ГГГГ ЧЧ:ММ" … } The data is loaded dynamically .. after opening the page, so I decided to deduce the required language in this way. Help with a regular expression or code that will help me with this.