Practise ICU message format vocabulary: plural selects, gender rules, interpolation, and complex message patterns.
0 / 18 completed
1 / 18
In ICU message format, the {count, plural, ...} syntax is used to:
ICU plural select chooses the correct grammatical form: {count, plural, one {# item} other {# items}} renders correctly for any quantity in any supported locale.
2 / 18
An ICU message like '{name} has {count, plural, one {# message} other {# messages}}' would render for count=1 as:
When count=1, the 'one' plural rule applies: the # is replaced with 1, producing '1 message' (singular). The full message renders as: Aliya has 1 message.
3 / 18
ICU select syntax {gender, select, female {...} male {...} other {...}} is used for:
Select chooses between variants based on a string value — gender-aware messages are important in languages like French, German, and Spanish where gender affects adjectives and pronouns.
4 / 18
In ICU format, the '#' character inside a plural case represents:
Inside a plural block, # expands to the count value. It also respects number formatting for the locale — in some locales 1,000 formats as 1.000.
5 / 18
Why is string concatenation like 'You have ' + count + ' messages' problematic for i18n?
Concatenation is an i18n anti-pattern: word order differs by language (German and Japanese often put verbs last), and it prevents handling plural forms correctly.
6 / 18
Alex from the frontend team is reviewing a PR that uses ICU messages. He sees this line in the code:
'{status, select, success {Good job!} failure {Something went wrong!}}'
What does the {# status } part of this message format represent?
ICU's {# } placeholders are used for variables. In this case, {# status } indicates that the value of the `status` variable will be inserted into the selected message string. The other options represent incorrect interpretations of ICU syntax or its purpose.
7 / 18
You're designing an API endpoint that returns user notification counts. The API response might look like this:
{"{notifications, plural, one {#} notification} other {# notifications}"}}
What does the {# notifications } represent in this context?
In an API response using ICU messages, {# notifications } represents the actual numeric value of the notifications count. It's a variable that will be substituted with the appropriate count before rendering the message. The other options are misinterpretations of how ICU is used within an API.
8 / 18
David is writing a PR description for a change that adds support for displaying different messages based on the user's locale. He wants to use ICU's pluralization functionality. Which of the following best describes the purpose of the {# } syntax within an ICU message?
The {# } syntax is fundamental to ICU's pluralization. It's used to represent variables that are dynamically substituted with values (usually numbers) when the message needs to adapt based on a specific count. This allows for localized phrasing like 'one item' vs. 'multiple items'.
9 / 18
A developer is using ICU messages in a mobile app and notices performance issues when the app switches between different locales frequently. What's the primary reason for these potential performance problems?
String concatenation, especially within loops or frequently changing contexts (like locale switching), can be a significant performance bottleneck. Each concatenation creates a new string object, leading to memory allocation and garbage collection overhead. ICU itself isn't inherently slow; the inefficient concatenation is the issue.
10 / 18
Alex from the frontend team is reviewing a PR that uses ICU messages. He sees this line in the code:
'{status, select, success {Good job!} failure {Something went wrong!}}'
What does the {# status } part of this message format represent?
ICU's {# } placeholders are used for variables. In this case, {# status } indicates that the value of the `status` variable will be inserted into the selected message string. The other options represent incorrect interpretations of ICU syntax or its purpose.
11 / 18
You're designing an API endpoint that returns user notification counts. The API response might look like this:
{"{notifications, plural, one {#} notification} other {# notifications}"}}
What does the {# notifications } represent in this context?
In an API response using ICU messages, {# notifications } represents the actual numeric value of the notifications count. It's a variable that will be substituted with the appropriate count before rendering the message. The other options are misinterpretations of how ICU is used within an API.
12 / 18
David is writing a PR description for a change that adds support for displaying different messages based on the user's locale. He wants to use ICU's pluralization functionality. Which of the following best describes the purpose of the {# } syntax within an ICU message?
The {# } syntax is fundamental to ICU's pluralization. It's used to represent variables that are dynamically substituted with values (usually numbers) when the message needs to adapt based on a specific count. This allows for localized phrasing like 'one item' vs. 'multiple items'.
13 / 18
A developer is using ICU messages in a mobile app and notices performance issues when the app switches between different locales frequently. What's the primary reason for these potential performance problems?
String concatenation, especially within loops or frequently changing contexts (like locale switching), can be a significant performance bottleneck. Each concatenation creates a new string object, leading to memory allocation and garbage collection overhead. ICU itself isn't inherently slow; the inefficient concatenation is the issue.
14 / 18
Sarah, a backend engineer, is drafting a Slack message to explain an upcoming change to the notification system. She wants to use ICU messages for improved localization. Which of the following best represents how Sarah should utilize the {#count} syntax within her message?
'We're updating the notification counts to handle different locales more effectively. The {#count} placeholder will dynamically insert the correct number of notifications based on the user's language settings.'
The {#count} syntax in ICU message format is specifically designed for handling numerical values within pluralization cases. Using `count` directly would be incorrect; the `#` symbol signifies a variable placeholder that ICU will resolve based on the actual count value. The plural form itself is defined by the 'other' clause.
15 / 18
Complete the following PR description snippet to accurately explain the use of ICU messages and pluralization in this change:
'This PR introduces support for displaying user activity counts. We're leveraging ICU messages to ensure correct localization. Specifically, we utilize {activity_count, select, one {#} activity} other {# activities} to handle different numbers of activities.'
The correct completion utilizes the standard ICU syntax: {variable, select, ...}. The `#` symbol within the curly braces is crucial; it's a placeholder that ICU will dynamically replace with the actual numerical value (the `activity_count`). Using incorrect keywords like 'number' or 'event' would result in invalid ICU message format.
16 / 18
During a standup meeting, Mark explains that the team is using ICU messages to display product usage statistics. He mentions: 'We're using {#users} to show how many users are currently active.' What does the {#users} part of this message represent?
'The {#users} placeholder is a variable that ICU will automatically replace with the current number of active users based on the user's locale and the system's data.'
The `#` symbol in ICU message format represents a variable placeholder. ICU resolves this placeholder at runtime by substituting it with the actual value determined by the surrounding context (in this case, the current count of active users). Options A and B are incorrect because they describe how the data is obtained rather than how ICU handles the variable; option C is also wrong as it's an API call, not the placeholder itself.
17 / 18
You are reviewing a code review comment from another developer regarding a feature flag that controls displaying personalized recommendations. The comment reads: 'Make sure to use ICU messages for the recommendation count, so we can handle different languages and number formats correctly.' What is the *primary* benefit of using ICU messages in this scenario?
'Using ICU allows us to easily adapt the message's text and formatting (like numbers) to match the user's locale and preferred settings without modifying the core logic.'
The core benefit of ICU messages in this case lies in its ability to handle localization – specifically formatting numbers appropriately for different locales (e.g., using commas instead of periods as decimal separators). Option A is incorrect because ICU doesn't manage database connections; option B describes translation, not formatting; and option D is a misleading assumption about always showing the message.
18 / 18
A developer reports performance issues when switching between locales in a mobile app that uses ICU messages. Which of the following is the *most likely* cause?
'Switching locales frequently triggers repeated evaluation of the pluralization rules within the ICU messages, which can be computationally expensive if not optimized.'
ICU's pluralization logic can be computationally intensive, especially when executed repeatedly. Each time the app switches locales and re-evaluates the pluralization rules within ICU messages, it introduces a performance bottleneck. The other options – image loading, network instability, and database overload – are less directly related to the performance issue stemming from ICU's pluralization engine.
What will I practise in "ICU Message Format Vocabulary"?
Practise ICU message format vocabulary: plural selects, gender rules, interpolation, and complex message patterns.
How many exercises are in this module?
This module has 18 multiple-choice exercises, each with instant feedback and a full explanation of the correct answer.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to use with no account, sign-up, or paywall.
Do I need to create an account to do these exercises?
No account is required. Just click an option to answer — your score for this session is tracked automatically in the progress bar above.
What happens if I choose the wrong answer?
You'll immediately see which answer was correct, plus a full explanation covering the vocabulary and reasoning behind it — mistakes are where most of the learning happens.
Can I retry the exercises if I want a higher score?
Yes — use the "Try again" button on the results screen to reset and go through all the questions again.
Is my progress saved if I close the page?
No. Progress is tracked only for your current visit; reloading or leaving the page resets the counter. This keeps the exercise simple and account-free.
Where can I find more i18n & l10n exercises?
Browse the full i18n & l10n hub for related drills, or check the "Next up" link below to continue with a connected topic.
How is this different from reading an article on the same topic?
Articles explain vocabulary and concepts in prose; this exercise tests and reinforces that vocabulary through active recall with immediate feedback — the two work best together.
Who writes these exercises?
Every exercise is written by the CoderSlingo team, drawing on real workplace English used in IT roles, then reviewed for accuracy and clarity.