如果国际化 rails 中的键大小写不同,它们的行为是否不同

Does the keys in internationalisation rails behaves different if they are of different case

示例来自 rails 文档:

en:
 hello: "Hello world"

两者有区别吗。按键的大小写重要吗?

en:
 Hello: "Hello world"

是的,按键的大小写很重要。

检查示例,

在en.yml

中定义变量
en:
  hello: "hello world"
  Hello: "HELLO WORLD"

并以

的身份从控制台访问它
2.2.1 :001 > I18n.t('hello')
 => "hello world" 
2.2.1 :002 > I18n.t('Hello')
 => "HELLO WORLD" 

请检查Rails Internationalization