Test Your Knowledge!

Quiz on advanced compile-time code generation.

1

Take the translator module for reference.

defmodule I18n do
  use Translator

  locale "muggle1",
    flash: [
      result: "%{first} %{last} is not a wizard!"
    ],
    users: [
      title: "Users",
    ]

  locale "muggle2",
    flash: [
      result: "%name is not a wizard!"
    ],
    users: [
      title: "Utilisateurs",
    ]
end

Which function should we run to get the following output?

"Harry Potter is not a wizard!"
A)
I18n.t("muggle2", "flash.result", name: "Harry")
B)
I18n.t("muggle1", "flash.result", first: "Harry", last: "Potter")
C)
I18n.t("muggle2", "flash.result", first: "Harry", last: "Potter")
Question 1 of 60 attempted

Get hands-on with 1200+ tech skills courses.