title: How to localize a date in Liquid?
body: <p>In my Rails 5 app I am using <a href="http://shopify.github.io/liquid/" rel="noreferrer">Liquid</a> to let my users generate content.</p>
  
  <p>Based on my users input, I init my template with something like this:</p>
  
  <pre><code>string   = "Order {{ order.id }} was created {{ order.date | date: '%A %d/%m-%Y' }}"
  template = Liquid::Template.parse(string)
  result   = template.render({'order' =&gt; {'id' =&gt; '123', 'date' =&gt; order.date}})
  </code></pre>
  
  <p>This would print something a la:</p>
  
  <pre><code>'Order 123 was created Sunday 14/01-2018'
  </code></pre>
  
  <p>But how do I build Liquid date localization into my Rails app?</p>
  
  <p>It does not seem to be supported in <a href="http://shopify.github.io/liquid/filters/date/" rel="noreferrer">the documentation</a>. However <a href="https://help.shopify.com/themes/development/internationalizing/locale-files#date-localization" rel="noreferrer">Shopify themselves seems to have build localization into their Liquid implementation</a>.</p>
  
  <p>I suppose I would need to pass my template a locale (<code>en</code>, <code>fr</code>, etc.) and a locale file. My Rails locale file looks like this:</p>
  
  <pre><code>en:
    datetime: &amp;datetime
      month_names:
        [~, January, February, March, April, May, June, July, August, September, October, November, December]
      day_names:
        [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday]
      abbr_day_names:
        [~, Sun, Mon, Thue, Wed, Thu, Fri, Sat]
      formats:
         default: "%d/%m/%Y"
         long: "%A %d/%m-%Y"
  </code></pre>
  
  <p>And I call it with:</p>
  
  <pre><code>l(order.date, :format =&gt; :long, :locale =&gt; 'en')
  </code></pre>
  
  <p>I would love to have access to a similar date localization inside my Liquid template.</p>