How is it right to combine two JSs?



  • There's a violin, a change of page language.

    var htmlElement = document.querySelector("html");
    

    document.querySelector("label").onclick = function() {
    if(htmlElement.getAttribute("lang") == "en") {
    document.querySelector("html").setAttribute("lang", "ru");
    } else if(htmlElement.getAttribute("lang") == "ru") {
    document.querySelector("html").setAttribute("lang", "en");
    }
    }

    He's tied to CSS.
    Thus,

    :root:lang(en) {
    --home: "Tickets";
    --Notification: "Notification";
    --sale: "Airline offers";
    --schedule: "Flight schedule";
    --search: "Find cheap flights";
    --buy: "Hurry up to buy cheap";
    --language-selection-phrase: "En";
    --change-lang: "Ru";

    :root:lang(ru){
    --home: "Авиабилеты";
    --sale: "Предложения авиакомпаний";
    --Notification: "Следить за ценой";
    --schedule: "Расписание авиарейсов";
    --search: "Поиск дешевых авиабилетов";
    --buy: "Успейте купить дёшево";
    --language-selection-phrase: "Ру";
    --change-lang: "En";

    }

    Creates two buttons on the website. There is also a form on the website that is caused by divine and 2nd scruples, with no language switching buttons.

    <div id="twidget" class="twidget-container"> </div>

    and JS
    It's a shape call in Russian.

    $('#twidget').twidget({
    locale: 'ru',
    default_origin: '',
    type: 'avia',
    });

    It's a shape challenge in English.

    $('#twidget').twidget({
    locale: 'en',
    default_origin: '',
    type: 'avia',
    });

    I need a language shift crypt to connect with some form of challenge.
    You know, if you click on RU, then the shape is loaded.

    $('#twidget').twidget({
    locale: 'ru',
    default_origin: '',
    type: 'avia',
    });

    And also, if you click on an en, the English uniform is already implemented.
    How do you do that without rebooting the page?



  • $('#twidget').twidget({
      locale: document.querySelector("html").getAttribute("lang"),
      default_origin: '',
      type: 'avia',
    });
    

Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2