7. Translatable Messages Checks

7.1. textdomain Check

What

If there is any message that is marked for translation with _("..."), there must be a textdomain statement.

Why

The YaST2 translator module needs to know where to take the messages to be translated from. This is what the textdomain specification does.

Technically one textdomain statement somewhere in the YCP program would be sufficient, i.e. include files or modules called with CallFunction() don't really require an additional textdomain specification.

However, it is highy recommended all YCP files with translatable messages include their own textdomain statement so each YCP file is self-sufficient in that regard, thus more easily reusable for other purposes. This policy is enforced with this check.

How

After being stripped of all comments, the entire YCP code is scanned for the translation marker sequence: An underscore immediately followed by an opening parenthesis: _(

If this sequence is found, presence of translatable messages is assumed. If no textdomain statment is found there will be an error.

On the other hand, if there is no text to translate, a textdomain statement is not necessary (but it can't hurt).

[Note]Note

Theoretically the "_(" sequence contained in a literal string (i.e. within double quotes "...") could falsely trigger this error, too. But if you do that, you are very likely to run into trouble with other tools as well - most likely even the original getext tools regularly used to extract the messages for translation. Bottom line: Don't do that.