Bird
0
0

Given this Angular template snippet:

medium📝 Predict Output Q4 of 15
Angular - Internationalization and Accessibility
Given this Angular template snippet:
<h1 i18n>Hello, {{ userName }}!</h1>

What will be the output if userName = 'Anna' and the app is running in English locale?
AHello, Anna!
BHello, {{ userName }}!
CBonjour, Anna!
DHello, userName!
Step-by-Step Solution
Solution:
  1. Step 1: Understand Angular interpolation with i18n

    The {{ userName }} is replaced by the variable value 'Anna' during rendering.
  2. Step 2: Check the locale and translation effect

    Since the locale is English and no translation changes the text, it outputs 'Hello, Anna!'.
  3. Final Answer:

    Hello, Anna! -> Option A
  4. Quick Check:

    Interpolation with i18n outputs variable value = Hello, Anna! [OK]
Quick Trick: i18n keeps interpolation but translates static text [OK]
Common Mistakes:
  • Expecting untranslated {{ userName }} text
  • Assuming French translation without locale change
  • Replacing variable name as string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes