This is my method from the core of magento:


and this is the code:

 $line = [
                'label' => __("%1: Line %2", $attributeConfig['label'], $lineIndex + 1),
                'component' => 'Magento_Ui/js/form/element/abstract',
                'config' => [

I would like to translate this %1: Line %2, which currently generates this:

Street Line 1, Street Line 2 and Street Line 3

into this:

Straat, Huisnummer, Toevoeging

But it doesn't work. I've tried this:

"%1: Line 1","%1"
"%1: Line 2","Huisnummer"
"%1: Line 3","Toevoeging"

But no luck :) Any suggestions ?


2 Answers 2


I just encountered the same problem and did a little trick to make translations work. You need to patch the file vendor/magento/module-checkout/Block/Checkout/AttributeMerger.php around line 292 to become:

from: 'label' => __("%1: Line %2", $attributeConfig['label'], $lineIndex + 1),

to: 'label' => __($attributeConfig['label'] . ": Line " . $lineIndex + 1),

Make sure you do it with a patch.

And apply translations that you need in your CSV file:

"Street Address: Line 1","Staatnaam"
"Street Address: Line 1","Huisnummer"
"Street Address: Line 3","Toevoeging"

To translate Magento expects %1: Line %2 in CSV, and in case you asked it is not a match for Street Address: Line 1, Street Address: Line 2, etc. With the patch/modification in core file, the change is not a big deal so you are safe to do it.

I know that the question is > 1 year old and hope it helps to you or anybody else that might encounter the same problem.


I'm having the same issue, I can't seem to find where I can change the translation for these fields. I hope someone will have a solution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.