I have a string that looks like
This is a list of all items with number 123456 in United States.
and I want to translate it to Swedish as
Detta är en lista över alla artiklar med nummer 123456 i USA.
The problem is that the number 123456
and the country name United States
are generated dynamically, but the string is delivered in its final form to the Twig template (it's used for <meta name="description" ... />
.
I already have a .po
file with country names that I'm translating, including
English Swedish
United States USA
The generated meta description string can have any combination of numbers and country names, so I can't hardcode any translations for the entire string. Is there any way I can re-use my existing translations for the country names and have them translated inside the meta description string, and have the number just stay as it is? Or do I need to somehow split the string up first, and then translate each part individually?