9. Widget / UI Function Parameter Checks

Parameters to YaST2 UI widgets plus some commonly used functions (e.g. Wizard::SetContents(), Popup::Message() etc.) are checked where possible - if the parameters are simple string constants, maybe surrounded by translation markers ("_("...")").

Optional widget parameters like `opt(...) or `id(...) are ignored.

The following examples will be checked:

PushButton("OK");
      

PushButton( _("Cancel"));
      

PushButton(`id(`apply), _("Apply"));
      

PushButton(`opt(`default), _("OK"));
      

More complex parameters like variable contents or YCP terms cannot be checked.

The parser used in check_ycp for that is really dumb. In fact, it only scans for keywords like PushButton outside string constants, tries to find the corresponding matching pair of parentheses "(...)" and splits everything inside into comma-separated subexpressions.

Only the most basic of those subexpressions are checked - only simple string constants "..." or string constants marked for translation _("...").

The following examples will not be checked:

CheckBox( "/dev/"+device );

CheckBox( sformat("/dev/%1"), device );

CheckBox( GetDevName() );

	string message = "OK";
	PushButton( message );
    

9.1. Keyboard Shortcut Check

What

Widgets that can have a keyboard shortcut (one character marked with an ampersand "&") are checked for presence of a keyboard shortcut.

[Note]Note

Consistency of the keyboard shortcuts is not checked, only presence. check_ycp cannot know which widgets will be on-screen at the same time, thus it cannot find out whether the same keyboard shortcut has been assigned twice to different widgets.

Why

This is for users whose mouse doesn't work (especially during installation time) as well as for experienced users who prefer working with the keyboard. Navigation from one widget to another is much easier when each widget that can get the keyboard focus can be reached with an [Alt] key sequence rather than repeatedly using the [Tab] key and/or the cursor keys.

There may be a lot more widgets that can have keyboard shortcuts than you expected. Basically, every widget that can somehow be operated with the keyboard (even if it is only scrolling) and that has an associated label (within, above or beside) can have a keyboard shortcut and should get one.

How

The widget parameter that acts as a label is checked for presence of exactly one ampersand "&".

See the widget checks of this section for more.

9.2. Translatable Messages Check

What

Widget parameters that are displayed literally as text are checked for translation markers ("_("...")").

Why

Every text message that ever gets to the end user is to be translated into the user's native language. This can only be made sure if the message is marked for translation.

How

See the intro of this section.