From ad1d2bed4a0877e801714ce5706990dde1d50aa7 Mon Sep 17 00:00:00 2001 From: Justin Perkins Date: Fri, 11 Nov 2022 14:07:40 -0500 Subject: [PATCH] Clarify YAML boolean caveat in en.yml template This clarifies that the boolean interpretation (1) is due to YAML rather than I18n, (2) is case insensitive, and (3) affects both keys and values. Co-authored-by: Jonathan Hefner --- .../test/dummy/config/locales/en.yml | 24 +++++++++---------- actiontext/test/dummy/config/locales/en.yml | 24 +++++++++---------- .../test/dummy/config/locales/en.yml | 24 +++++++++---------- .../rails/app/templates/config/locales/en.yml | 24 +++++++++---------- 4 files changed, 44 insertions(+), 52 deletions(-) diff --git a/actionmailbox/test/dummy/config/locales/en.yml b/actionmailbox/test/dummy/config/locales/en.yml index 61ed8b2c71..6c349ae5e3 100644 --- a/actionmailbox/test/dummy/config/locales/en.yml +++ b/actionmailbox/test/dummy/config/locales/en.yml @@ -1,6 +1,6 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. +# Files in the config/locales directory are used for internationalization and +# are automatically loaded by Rails. If you want to use locales other than +# English, add the necessary files in this directory. # # To use the locales, use `I18n.t`: # @@ -16,18 +16,16 @@ # # This would use the information in config/locales/es.yml. # -# The following keys must be escaped otherwise they will not be retrieved by -# the default I18n backend: +# To learn more about the API, please read the Rails Internationalization guide +# at https://guides.rubyonrails.org/i18n.html. # -# true, false, on, off, yes, no +# Be aware that YAML interprets the following case-insensitive strings as +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings +# must be quoted to be interpreted as strings. For example: # -# Instead, surround them with double quotes. -# -# en: -# "true": "foo" -# -# To learn more, please read the Rails Internationalization guide -# available at https://guides.rubyonrails.org/i18n.html. +# en: +# "yes": yup +# enabled: "ON" en: hello: "Hello world" diff --git a/actiontext/test/dummy/config/locales/en.yml b/actiontext/test/dummy/config/locales/en.yml index 61ed8b2c71..6c349ae5e3 100644 --- a/actiontext/test/dummy/config/locales/en.yml +++ b/actiontext/test/dummy/config/locales/en.yml @@ -1,6 +1,6 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. +# Files in the config/locales directory are used for internationalization and +# are automatically loaded by Rails. If you want to use locales other than +# English, add the necessary files in this directory. # # To use the locales, use `I18n.t`: # @@ -16,18 +16,16 @@ # # This would use the information in config/locales/es.yml. # -# The following keys must be escaped otherwise they will not be retrieved by -# the default I18n backend: +# To learn more about the API, please read the Rails Internationalization guide +# at https://guides.rubyonrails.org/i18n.html. # -# true, false, on, off, yes, no +# Be aware that YAML interprets the following case-insensitive strings as +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings +# must be quoted to be interpreted as strings. For example: # -# Instead, surround them with double quotes. -# -# en: -# "true": "foo" -# -# To learn more, please read the Rails Internationalization guide -# available at https://guides.rubyonrails.org/i18n.html. +# en: +# "yes": yup +# enabled: "ON" en: hello: "Hello world" diff --git a/activestorage/test/dummy/config/locales/en.yml b/activestorage/test/dummy/config/locales/en.yml index 61ed8b2c71..6c349ae5e3 100644 --- a/activestorage/test/dummy/config/locales/en.yml +++ b/activestorage/test/dummy/config/locales/en.yml @@ -1,6 +1,6 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. +# Files in the config/locales directory are used for internationalization and +# are automatically loaded by Rails. If you want to use locales other than +# English, add the necessary files in this directory. # # To use the locales, use `I18n.t`: # @@ -16,18 +16,16 @@ # # This would use the information in config/locales/es.yml. # -# The following keys must be escaped otherwise they will not be retrieved by -# the default I18n backend: +# To learn more about the API, please read the Rails Internationalization guide +# at https://guides.rubyonrails.org/i18n.html. # -# true, false, on, off, yes, no +# Be aware that YAML interprets the following case-insensitive strings as +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings +# must be quoted to be interpreted as strings. For example: # -# Instead, surround them with double quotes. -# -# en: -# "true": "foo" -# -# To learn more, please read the Rails Internationalization guide -# available at https://guides.rubyonrails.org/i18n.html. +# en: +# "yes": yup +# enabled: "ON" en: hello: "Hello world" diff --git a/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml b/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml index 61ed8b2c71..6c349ae5e3 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml +++ b/railties/lib/rails/generators/rails/app/templates/config/locales/en.yml @@ -1,6 +1,6 @@ -# Files in the config/locales directory are used for internationalization -# and are automatically loaded by Rails. If you want to use locales other -# than English, add the necessary files in this directory. +# Files in the config/locales directory are used for internationalization and +# are automatically loaded by Rails. If you want to use locales other than +# English, add the necessary files in this directory. # # To use the locales, use `I18n.t`: # @@ -16,18 +16,16 @@ # # This would use the information in config/locales/es.yml. # -# The following keys must be escaped otherwise they will not be retrieved by -# the default I18n backend: +# To learn more about the API, please read the Rails Internationalization guide +# at https://guides.rubyonrails.org/i18n.html. # -# true, false, on, off, yes, no +# Be aware that YAML interprets the following case-insensitive strings as +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings +# must be quoted to be interpreted as strings. For example: # -# Instead, surround them with double quotes. -# -# en: -# "true": "foo" -# -# To learn more, please read the Rails Internationalization guide -# available at https://guides.rubyonrails.org/i18n.html. +# en: +# "yes": yup +# enabled: "ON" en: hello: "Hello world"