Without a translation, this would get me this afternoon:
Date.today.strftime("%A")
How do I localize it?
those. "Mardi" if I18n.locale set to fr .
I18n.locale
fr
You probably have the following in your locale file (s):
# example with fr fr: date: day_names: [Dimanche, Lundi, Mardi, Mercredi, Jeudi, Vendredi, Samedi]
To get today's name, you can do:
week_day = Date.today.wday # Returns the day of week (0-6, Sunday is zero) I18n.t('date.day_names')[week_day]
or ultimately
I18n.l(Date.today, format: '%A')
l Date.today, format: "%A"
Will work if you have day_names in your translation file.
day_names
Source: https://habr.com/ru/post/1235797/More articles:Failed to complete target ... code = 500 - sonarqubeSwift: The static property in the CAN protocol extension can be overridden, but why? - iosRecord audio and transfer data to UIWebView (JavascriptCore) on iOS 8/9 - iosAPI Manager API User Consent Screen Configuration - oauthCannot read property "pushState" from undefined - javascriptServer error while saving consent screen - apihow to edit column on laravel? - sqlSplit multiple lines into a list of objects in C # - stringEdit SQL in Power Query - excel-2010How to set value of GhostDown Markdown editor - javascriptAll Articles