I created a plugin that allows you to use nested arrays in YAML files to define your language variables. I needed this functionality for another plugin I’m currently developing, but decided to separate it in its own plugin and use it as a dependency. It can be pretty useful if you have a lot of variables.
For example, in en.yml
, you could have:
foo:
bar:
baz: test
qux: test2
instead of writing:
foo.bar.baz: test
foo.bar.qux: test2
You could use both approaches, though, even combine them (which doesn’t really make sense, but still). No matter which approach you use, you always use the variables with t('foo.bar.baz')
.
Check it here: