A memorandum for myself It's easy to forget, so I'll summarize it
config/application.rb
#Omission
module App
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0
#Japanese language setting
config.i18n.default_locale = :ja
#Japan time setting
config.time_zone = 'Tokyo'
#Omission
config/locales/ja.yml =>Create
config/locales/ja.yml
ja:
time:
formats:
default: "%Y/%m/%d %H:%M:%S"
#Since it is the default to the last, set with a pattern that seems to be used often
sample.rb
l sample.created_at =>Display with default settings
sample.rb
sample.created_at.strftime('20%y year%m month') => "20xx yy month"
Am I the only one who thinks the l method sounds cool?
✔︎
Recommended Posts