Welcome to the Python screen.
The question is on your right: Format Localized App Messages. Read through the requirements first.
Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?
A global mobile app stores message templates for different locales. Implement a formatter that selects the best available localized template and replaces placeholders with provided values.
Write a function format_message(translations, locale, key, params) that returns the formatted string for a message key.
translations: a dictionary where each locale maps to another dictionary of message keys to template stringslocale: a locale string such as "en-US" or "fr-CA"key: the message key to renderparams: a dictionary of placeholder names to replacement valuesen for en-US)enkey if no template existsPlaceholders use {name} syntax. Replace only placeholders present in params; leave unknown placeholders unchanged.
-{placeholder} syntaxdef format_message(translations, locale, key, params):