# changing translation parameter

**URL:** <https://community.hubspot.com/t/changing-translation-parameter/84111>\
**Category:** CMS Development\
**Created:** [June 26, 2023, 2:01pm UTC](https://community.hubspot.com/t/changing-translation-parameter/84111 "2023-06-26T14:01:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [June 26, 2023, 2:01pm UTC](https://community.hubspot.com/t/changing-translation-parameter/84111/1 "2023-06-26T14:01:10Z")

</div>

In the @hubspot/cms-quotes-theme/templates/\_locales/xx/messages.json file, there’s some translations with parameters inside:

```lia-code-sample
 "invoice_after_discount": {
 "message": "after {{ discount_amount }} discount",
 "description": "",
 "placeholders": null
 },

```

If I use this translation key via

`<p>{{template_translations.invoice_after_discount.message }}</p>`

It renderes without the variable: “\<p\>after discount\</p\>”

How can I add the variable `discount_amount` to this translation key?  
First thought was that there’s some filter I can apply like

`<p>{{template_translations.invoice_after_discount.message|trans("discount_amount", 5) }}</p>`

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [June 26, 2023, 2:59pm UTC](https://community.hubspot.com/t/changing-translation-parameter/84111/2 "2023-06-26T14:59:48Z")

</div>

Hi @Anonymous

To add the discount\_amount variable to the translation key, you can use the trans filter in HubL to pass the variable value while rendering the translation. Here’s an example of how you can modify the code:

\<p\>{{ template\_translations.invoice\_after\_discount.message | trans(discount\_amount=5) }}\</p\>

In the above code, `5` is the value you want to pass for the `discount_amount` variable. Replace `5` with the actual value you want to use.

The `trans` filter allows you to provide additional context or parameters for the translation. By specifying `discount_amount=5`, you are passing the `discount_amount` variable with the value of `5` to the translation. This will replace the `{{ discount_amount }}` placeholder in the translation string with the provided value.

Make sure you have the correct syntax and that the `discount_amount` variable is passed as a parameter to the `trans` filter. This should render the translation with the variable included, resulting in an output like `<p>after 5 discount</p>`.

Hope this will helps you out. Please mark it as **Solution Accepted** to help other Community member. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/system/32/124_2.png) [@system](https://community.hubspot.com/u/system)\
**Post date:** [June 27, 2023, 8:00am UTC](https://community.hubspot.com/t/changing-translation-parameter/84111/3 "2023-06-27T08:00:31Z")

</div>

Thank you for your reply, Gaurav! The trans filter you are mentioning does not seem to work, and I can’t find any documentation for it. When I wrote variable\_name|trans() I just imagined what would be nice, I have not seen this somewhere else, so if it is a thing, it’s a wild guess.  
However, as stated, this does not seem to work; |trans(variable=5) or |trans(variable, 5) or |trans(“variable”, 5).
