Everybody should be able to add checks for a new widget or a new function that uses keyboard shortcuts (unlikely) or translatable messages (very likely) - even without any knowledge of Perl:
Locate the check_widget_params()
function.
Add your widget to the list (the large regexp) near the function beginning, where all the other widgets are. Be careful not to include any whitespace (blanks or tabs) inside the parentheses. Wrong:
( MyNewWidget ) |
OK:
(MyNewWidget) |
Add an elsif()
branch to the large
if()
...elsif()
...elsif()
construction:
elsif ( $widget =~ /MyWidget/ ) { check_keyboard_shortcut ( $widget, $line_no, 1, @args ); check_translation ( $widget, $line_no, 1, @args ); }
You might have to change the third parameter according to your widget or
function: This is the number of the parameter to be checked (the first one is
1) after all `opt()
and `id()
parameters have been removed.
Of course you can omit the keyboard
shortcut check
(check_keyboard_shortcut()
) if it doesn't make sense for your
widget or function.
If there is more than one parameter to be checked for translatable messages, add a call to check_translation()
for
each.
Like Linus Torvalds once said: "Use the source, Luke!" ;-)
check_ycp
's sources are extensively commented, even the many regular
expressions used there. But changing those regexps really requires some
in-depth knowledge of regexps in general and Perl regexps in particular. If you
feel unsafe, better not touch them.
Other than that, use your creativity.