Answer the question
In order to leave comments, you need to log in
[Ruby => Sinatra] How to do date formatting and add Russian language?
Hey!
I'm working on a Sinatra project and I'm currently learning the R18n.
I added gem sinatra-r18n
In main.rb added
require 'sinatra/r18n'
R18n::I18n.default = 'ru'
R18n.default_places { './config/locales/' }
<option value="<%= date.date %>"><%= l date.date, :format => :short %></option>
Unknown time formatter {:format=>:short}
file: locale.rb location: localize line: 167
Answer the question
In order to leave comments, you need to log in
Are you sure that there is such a format https://github.com/ai/r18n/blob/master/r18n-core/l... ?
in my opinion an example from rails.
To localize the date, you need to use time in yml files, because such an object as yours is apparently a DateTime class (or similar):
ru:
time:
formats:
short: ! '%-d %b'
unknown time formatter {:format=>:short}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question