Test Your Knowledge!

Quiz on advanced compile-time code generation.

1

Take the translator module for reference.

defmodule I18n do
  use Translator

  locale "en",
    flash: [
      hello: "Hello %{first} %{last}!",
      bye: "Bye, %{name}!"
    ],
    users: [
      title: "Users",
    ]

  locale "fr",
    flash: [
      hello: "Salut %{first} %{last}!",
      bye: "Au revoir, %{name}!"
    ],
    users: [
      title: "Utilisateurs",
    ]

  locale "ur",
    flash: [
      
      hello: "Salam %{first} %{last}!",
      bye: "Khuda Hafiz, %{name}!"
    ],
    users: [
      title: "Utilisateurs",
    ]
end

What would be the output of the following command?

iex> I18n.t("ur", "flash.hello", first: "Harry", last: "Potter")
A)

Hello Harry Potter!

B)

Au revoir Harry Potter!

C)

Salam Harry Potter!

Question 1 of 60 attempted

Get hands-on with 1400+ tech skills courses.