0
0
Angularframework~20 mins

Marking text for translation in Angular - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Angular i18n Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
1:30remaining
What will be the rendered output of this Angular template?
Consider this Angular template snippet using i18n attribute:
<h1 i18n>Welcome to our site!</h1>

What will the user see if no translation files are loaded?
Angular
<h1 i18n>Welcome to our site!</h1>
AThe text 'Welcome to our site!' will be displayed as is.
BThe text will be replaced by a key like 'WELCOME_TO_OUR_SITE'.
CNothing will be displayed because translation is missing.
DAn error will be thrown in the console about missing translation.
Attempts:
2 left
💡 Hint
Think about what Angular does if no translation is found for marked text.
📝 Syntax
intermediate
1:30remaining
Which is the correct way to mark a button label for translation in Angular?
You want to mark the button text 'Submit' for translation. Which Angular syntax is correct?
A<button translate>Submit</button>
B<button i18n>Submit</button>
C<button [i18n]="'Submit'">Submit</button>
D<button i18n-label>Submit</button>
Attempts:
2 left
💡 Hint
Angular uses a specific attribute to mark text for translation.
state_output
advanced
2:00remaining
What will be the value of the translated message in this Angular component?
Given this Angular component code snippet:
import { Component } from '@angular/core';
@Component({
  selector: 'app-greet',
  template: `

Hello, {{name}}!

` }) export class GreetComponent { name = 'Alice'; }

Assuming the translation file replaces 'Hello, {$INTERPOLATION}!' with 'Hola, {$INTERPOLATION}!', what will be rendered?
AHola, Alice!
BHello, Alice!
CHello, {{name}}!
DHola, {{name}}!
Attempts:
2 left
💡 Hint
Angular replaces interpolation inside translated strings.
🔧 Debug
advanced
2:00remaining
Why does this Angular template fail to translate the button label?
Template snippet:
<button i18n-label>Click me</button>

Translation file contains a translation for 'Click me'. Why is the label not translated?
Angular
<button i18n-label>Click me</button>
ABecause the i18n attribute must be on a parent element.
BBecause the translation file is missing the key for 'Click me'.
CBecause the button element cannot be translated.
DBecause 'i18n-label' is not a valid Angular i18n attribute.
Attempts:
2 left
💡 Hint
Check Angular's official i18n attribute names.
🧠 Conceptual
expert
3:00remaining
How does Angular handle pluralization in translations marked with i18n?
You want to translate a message that changes based on a number, like 'You have 1 message' vs 'You have 5 messages'. How does Angular's i18n system support this?
AAngular requires separate i18n tags for each plural form and switches them manually.
BAngular does not support pluralization; you must handle it in component code.
CAngular uses ICU message syntax inside the i18n attribute to handle plural forms.
DAngular uses a special directive called i18nPlural to handle pluralization.
Attempts:
2 left
💡 Hint
Think about how ICU messages work in translation systems.