I am working with Grav and trying to dynamically select a specific array to use from a config variable based on the current active language. I know I can use if and else if statements, but I would rather not do that because each time another array is added as an option, conditional block will grow in size.
I know that in Grav I can use {{~grav.language.getActive~}}
to print the currently active language, but I would like to use that value as another part of a Grav variable. For example,
Say my config file is called video, is stored in user\config\, and looks like this:
error:
en: "This is an error."
es: "Esto es un error."
I would like to access the value error.(active_language_here).
I have tried:
{{ config.video.error.{{~grav.language.getActive~}} }}
which has an error saying: Expected name or number.{{attribute(config.video.error, Language->getActive())}}
which has an error saying: Unexpected token "operator" of value ">"
If you need any more information, please let me know! Thank you for the help!
Is there a way to do this in Grav as of right now?