This page raises the question and the solution (
https://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_8.html#SEC136).
But, you can also use the concept of sections. To get a message with multiple context translations, you can call the function with an additional argument - the name of the section, which can play the role of context. A translation file with messages may contain several versions of the translation under section names. The translation in the main section can be obtained in the usual way, without any additional argument. This means not all messages, but only the necessary messages. In one section there is usually one, or several messages.
For example,
#volume=menu|file
Open...=
Close=
#volume=
Open...=
Close=
. The untitled section is the main (here is the second one) one.