Default value for __x() with context not returned if non default language translation is empty

I am not sure if this is desired behavior or not. I have pot and po files generated by Cake’s i18n shell.

I have following translation in non default language pl

msgctxt "Navigation menu"
msgid "Search"

And now, behavior is different depending on language beeing default or not.
__x("Navigation menu", "Search")gives me an empty string in language pl. If i switch to any other language, so the default lang would be picked up (default.pot in my case) default value “Search” is returned as I would expect it to be.

Defining translation for example like this

msgctxt "Navigation menu"
msgid "Search"
msgstr "test test"

will result in returning “test test” for pl and “Search” for default language.

According to the official documentation, it seems to be correct:


Sometimes translations strings can be ambiguous for people translating them. This can happen if two strings are identical but refer to different things. For example, ‘letter’ has multiple meanings in English. To solve that problem, you can use the __x() function:

And in case of you don’t know, make your translation faster with PoEdit :wink: