Bird
0
0

Identify the error in this Angular template snippet for translation:

medium📝 Debug Q14 of 15
Angular - Internationalization and Accessibility
Identify the error in this Angular template snippet for translation:
<button i18n="Submit button">Submit</button>
AThe i18n attribute should be written as i18n-desc
BThe description should be inside @@, like i18n="@@Submit button"
CThe text 'Submit' should be inside double curly braces {{}}
DThe i18n attribute must be on a <span>, not a <button>
Step-by-Step Solution
Solution:
  1. Step 1: Check the i18n attribute format

    The description or meaning for translation keys must be prefixed with @@ inside the i18n attribute, e.g., i18n="@@Submit button".
  2. Step 2: Validate other options

    i18n can be used on any element, including button. Text does not require curly braces for static content. The attribute i18n-desc is not valid.
  3. Final Answer:

    The description should be inside @@, like i18n="@@Submit button" -> Option B
  4. Quick Check:

    Description needs @@ prefix in i18n attribute [OK]
Quick Trick: Descriptions in i18n need @@ prefix inside quotes [OK]
Common Mistakes:
  • Omitting @@ prefix for descriptions
  • Thinking i18n only works on elements
  • Using i18n-desc instead of i18n

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes