Обучаю битриксу программистов, интеграторов. Подробнee ⇒

Скрипт для генерации мессаджей для мультиязычности



Задолбало меня вводить ключи. потом дополнять ланги.
<?require_once($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/include/prolog_before.php");
CJSCore::Init(array("jquery"));
global $APPLICATION;?>

<html>
<head>
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap" rel="stylesheet">
   <?$APPLICATION->ShowHead()?>
</head>
<body>   
   <div class="main">
      <div class="container">
         <input type="text" id="text"> <button id="calc">ok</button>
         <br>
         <div id="result"></div>
         <br>
      </div>
   </div>
   <script>
      $(document).ready(function(){
         
         $('#calc').on('click',function(e){
            let prefix = "NANO_";
            e.preventDefault();
            let s1 = $('#text').val();   
            s = prefix + s1.replace(/ /g, "_").toUpperCase();               
            $("#result").html("<p>"+s+"<br><br>GetMessage('"+s+"')</p><p><?=GetMessage('"+s+"')?></p><p>"+'$MESS["'+s+'"] = "'+s1+'";</p>');

         });
         

      });   
   </script>
   <style>
      body{
         font-family: "Open Sans", sans-serif;
           font-optical-sizing: auto;
           font-weight: <weight>;
           font-style: normal;
           font-variation-settings: "wdth" 100;
      }
      .main{
         display: flex;
         justify-content: center;

      }
      .container{
         width: 800px;
      }
      #text{
         width: 420px;
          font-size: 20px;
          padding: 4px 10px;
          margin: 100px 0 42px;
      }

   </style>
</body>


</html>
из текста генерирует ключ и другие удобные штуки
Если блог был полезным, можете угостить меня "чашечкой кофе" :)

Сбер по номеру телефона +7 (953) 585-13-09 Вероника.
Спасибо!