Re: Code formatting
"H.G. Muller" <[email protected]> Wed, 6 Apr 2016 23:31:54 +0200
| Newsgroups | gmane.comp.gnu.xboard.devel |
|---|---|
| Message-ID | <[email protected]> |
Op 4/6/2016 om 10:20 PM schreef Roland Illig: > When I looked at xoption.c, it seemed like a total mess to me. Yeah, that is what you get when several different people with different styles contribute code... > While there, I noticed this code: > > strcmp(option[i].name, "*") > > Would that still work if I were to translate the "*" to something > different than "*"? Yes, that would still work. The N_() around the "*" in the Option table is just a marker to make software other than the compiler notice the "*" string, so that it ends up in the .pot file. To the compiler it is a no-op, and the string stays untranslated in the .name field of the Option. So the strcmp() compares the untranslated .name with an untranslated "*" to recognize it. To create the button with gtk_button_new_with_label(), the option[i].name is surrounded with _(), so that the translation for "*" will appear on the button. The same for the other one-letter buttons "B", "R" and "G" that are recogized in the GTK version of xoptions.c in order to be ignored.