ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 32 - AD0-E720 discussion

Report
Export

An Adobe Commerce developer is working on a custom knockout Ul component and they need to add the text Happy Birthday. to be translated inside an .html template.

How would the developer add the text?

A.
<span data-bind=Mil8n: 'Happy Birthday.''></span>
Answers
A.
<span data-bind=Mil8n: 'Happy Birthday.''></span>
B.
<span data-bind='il8n: Happy Birthday.'></span>
Answers
B.
<span data-bind='il8n: Happy Birthday.'></span>
C.
<!-- ko il8n = 'Happy Birthday.' --><!-- /ko -->
Answers
C.
<!-- ko il8n = 'Happy Birthday.' --><!-- /ko -->
Suggested answer: B

Explanation:

To add the text Happy Birthday. to be translated inside an .html template, the developer should use the i18n binding. This binding allows the developer to specify the text as a string literal and translate it using the Magento translation mechanism. For example:

<span data-bind=''i18n: 'Happy Birthday.'''></span>

This will render the text as it is, or translate it if a translation file is available for the current locale. The i18n binding can also accept variables or expressions as arguments. For example:

<span data-bind=''i18n: name + ' Happy Birthday.'''></span>

This will render the text with the value of name variable, or translate it if a translation file is available for the current locale. The Mil8n and il8n bindings are not valid and will not work, as they are misspelled and do not match the knockout binding syntax.

Reference: [Knockout bindings], [i18n binding]

asked 02/10/2024
Filippo Bertuzzi
26 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first