Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9009615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:14:46+00:00 2026-06-16T02:14:46+00:00

I want to use variables declared in yml file right there. For example, I

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:14:48+00:00Added an answer on June 16, 2026 at 2:14 am

    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:

    en:
      site_name: "Site Name"
      static_pages:
        company:
          description: ! '%{site_name} is an online system'
    

    and then call in the appropriate view with the site name as a parameter:

    t('.description', site_name: t('site_name'))
    

    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:

    en:
      site_name: &site_name "Site Name"
      static_pages:
        company:
          description:
            - *site_name
            - "is an online system"
    

    and then you would join the array in the appropriate view like this:

    t('.description').join(" ")
    

    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:

    • this StackOverflow answer regarding concatenating i18n strings (tl;dr Please don’t for your translation team’s sake).
    • StackOverflow questions here and here that are similar to your question.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use the variables i have declared inside a function in one
I am a nOOb to jQuery. I want to use variables in jQuery to
How can I use variables to set my timer? I want to control delay
I want to use a bunch of local variables defined in a function, outside
I want to use a variable in a regex, like this: variables = ['variableA','variableB']
I have a C# script and I want to use some of the variables
I want to know all the variables that have been declared within an include
I have classA that has some variables declared in its .h file (arrays, strings,
Since variables names are declared local if there is an assignment to them within
I have declared and initialized two variables as shown below: int a=5; char* str;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.