Ruby on Rails5 Quick Learning Practice Guide 5.2 Compatible Chapter3
Create a Capter3 task management application
Create a simple "task management application" with CRUD from scratch without using scaffold.
environment
-
Ruby 2.5.1
-
Ruby on Rails 5.2.1
-
PostgreSQL 10.5
Make it possible to issue Rails error messages in Japanese
Download the translated file (raw file) from the Rails-i18n repository on Github as config / locales / ja.yml
.
wget https://raw.githubusercontent.com/svenfuchs/rails-i18n/master/rails/locale/ja.yml --output-file=config/locales/ja.yml
If you check config / locales / ja.yml
, the following log is described.
--2020-06-26 14:40:30-- https://raw.githubusercontent.com/svenfuchs/rails-i18n/master/rails/locale/ja.yml
Connecting to 192.168.24.1:8080 ... Connected.
Proxy sent connection request, waiting for response ... 200 OK
Length: 5117 (5.0K) [text / plain]
Saving in `ja.yml'
0K .... 100% 10.3M=0s
2020-06-26 14:40:31 (10.3 MB / s) --Save to `ja.yml'completed [5117/5117]
To WEB browser as a solution
https://raw.githubusercontent.com/svenfuchs/rails-i18n/master/rails/locale/ja.yml
Paste.
Paste the contents of the following text displayed in ja.yml and save it.
ja:
activerecord:
errors:
messages:
record_invalid:'Validation failed:% {errors}'
restrict_dependent_destroy:
has_one: "Cannot be deleted because% {record} exists"
has_many: "Cannot be deleted because% {record} exists"
date:
abbr_day_names:
- Day
- Month
--Tue
- water
- wood
-
Money
--Sat
abbr_month_names:
- January
- February
--March
--April
- May
- June
- July
--August
- September
- October
- November
- December
day_names:
--Sunday
--Monday
--Tuesday
--Wednesday
--Thursday
--Friday
-
Saturday
formats:
default: "%Y/%m/%d"
long: "% Y year% m month% d day (% a)"
short: "%m/%d"
month_names:
- January
- February
--March
--April
- May
- June
- July
--August
- September
- October
- November
- December
order:
- :year
- :month
- :day
datetime:
distance_in_words:
about_x_hours:
one: about 1 hour
other: about% {count} hours
about_x_months:
one: about 1 month
other: about% {count} months
about_x_years:
one: about 1 year
other: about% {count} years
almost_x_years:
one: less than a year
other: "% {count} years or less"
half_a_minute: Around 30 seconds
less_than_x_seconds:
one: within 1 second
other: "less than% {count} seconds"
less_than_x_minutes:
one: within 1 minute
other: "less than% {count} minutes"
over_x_years:
one: over a year
other: "% {count} years or more"
x_seconds:
one: 1 second
other: "% {count} seconds"
x_minutes:
one: 1 minute
other: "% {count} minutes"
x_days:
one: 1 day
other: "% {count} days"
x_months:
one: 1 month
other: "% {count} months"
x_years:
one: 1 year
other: "% {count} year"
prompts:
second: seconds
minute: minute
hour: hour
day: day
month: month
year: year
errors:
format: "%{attribute}%{message}"
messages:
accepted: Please accept
Please enter blank:
confirmation: and% {attribute} inputs do not match
Please enter empty:
equal_to: should be% {count}
even: should be even
exclusion: is reserved
greater_than: should be greater than% {count}
greater_than_or_equal_to: should be greater than or equal to% {count}
inclusion: is not in the list
invalid: is an invalid value
less_than: should be less than% {count}
less_than_or_equal_to: should be less than or equal to% {count}
model_invalid:'Validation failed:% {errors}'
Please enter not_a_number: as a number
enter not_an_integer: as an integer
odd: should be odd
other_than: should be a value other than% {count}
do not enter present:
Please enter required:
taken: already exists
Enter too_long: within% {count} characters
Enter too_short: with at least% {count} characters
Enter wrong_length: in% {count} characters
template:
body: Check the following items
header:
one: "An error occurred in% {model}"
other: "% {count} errors have occurred in% {model}"
helpers:
select:
prompt: Please select
submit:
create: register
submit: save
update: update
number:
currency:
format:
delimiter: ","
format: "%n%u"
precision: 0
separator: "."
significant: false
strip_insignificant_zeros: false
unit: Yen
format:
delimiter: ","
precision: 3
separator: "."
significant: false
strip_insignificant_zeros: false
human:
decimal_units:
format: "%n %u"
units:
billion: billion
million: million
quadrillion: Thousand trillion
thousand: Thousand
trillion: trillion
unit: ''
format:
delimiter: ''
precision: 3
significant: true
strip_insignificant_zeros: true
storage_units:
format: "%n%u"
units:
byte: byte
eb: EB
gb: GB
kb: KB
mb: MB
pb: PB
tb: TB
percentage:
format:
delimiter: ''
format: "%n%"
precision:
format:
delimiter: ''
support:
array:
last_word_connector: "、"
two_words_connector: "、"
words_connector: "、"
time:
am: am
formats:
default: "% Y year% m month% d day (% a)% H hour% M minute% S second% z"
long: "%Y/%m/%d %H:%M"
short: "%m/%d %H:%M"
pm: pm
Now you are ready to create your application.