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

Which function should we run to get the following output?

"Au revoir Harry Wizard!"
A)
I18n.t("en", "flash.bye", first: "Harry", last: "Potter")
B)
I18n.t("fr", "flash.bye", first: "Harry", last: "Wizard")
C)
I18n.t("fr", "flash.bye", name: "Harry Wizard")
Question 1 of 60 attempted

Get hands-on with 1200+ tech skills courses.