title: add language constants to Joomla component javascript
body: <p>My component includes a java script file:</p>
  
  <pre><code>$doc-&gt;addScript("/components/com_cam/js/cam.js");
  </code></pre>
  
  <p>I have several client side messages that I'd like to add with language constants, i.e.</p>
  
  <pre><code>&lt;?php echo JText::_('COM_CAM_SEND_LABEL'); ?&gt;
  </code></pre>
  
  <p>Easy enough in your front end php code like default.php but what about messages inside <code>cam.js</code>? </p>
  
  <p>Such as my jquery validation:</p>
  
  <pre><code>        messages: {
              cam: {
                  required: "Enter a label",
                  minlength: jQuery.format("At least {0} characters required!"),
                  maxlength: jQuery.format("Maximum {0} characters allowed!")
              }
          }
  </code></pre>
  
  <p>What is the best practice for this?</p>