title: How to do advanced i18n with Mustache.js?
body: <p>It seems Twitter is using a <a href="https://github.com/bcherry/mustache.js" rel="noreferrer">fork</a> of <a href="https://github.com/janl/mustache.js/" rel="noreferrer">Mustache.js</a> to provide i18n to its templates?</p>
  
  <p>Could someone give a brief example of how this is done and perhaps also outline what semantics is necessary to crowdsource these translations?</p>
  
  <p>There is of course this simple example:</p>
  
  <pre><code>var template = "{{_i}}{{name}} is using mustache.js!{{/i}}"
  
  var view = {
    name: "Matt"
  };
  
  var translationTable = {
    // Welsh, according to Google Translate
    "{{name}} is using mustache.js!": "Mae {{name}} yn defnyddio mustache.js!"
  };
  
  function _(text) {
    return translationTable[text] || text;
  }
  
  alert(Mustache.to_html(template, view));
  // alerts "Mae Matt yn defnyddio mustache.js!"
  </code></pre>
  
  <p>But I'd like some more insight on how to structure the _(text) function and translationTable to provide conditionals, singular, plural etc. Examples of solving more advanced use cases would be much appreciated. </p>