I want to use variables declared in yml file right there.
For example, I declared site_name and want to use it below in description.
en:
site_name: &site_name "Site Name"
static_pages:
company:
description: *site_name #this works fine
description: "#{*site_name} is an online system" #this doesn't work
How can I combine *site_name variable with additional text?
The short answer is, I believe, no you cannot do string interpolation in YAML the way you want using an alias.
In your case, what I would do is have something like the following in my locale file:
and then call in the appropriate view with the site name as a parameter:
which would get you
"Site Name is an online system".However, if you’re desperate to use aliases in your YAML file to concatenate strings together, the following completely unrecommended code would also work by having the string be two elements of an array:
and then you would
jointhe array in the appropriate view like this:Which would also get you
"Site Name is an online system".However, before you decide to go down this path, apart from the question that @felipeclopes linked to, have a look at: