On Tue, Oct 04, 2022 at 02:52:21AM -0700, Bill Kendrick wrote:
>
> The documentation that explains to developers how to use
> the Tux Paint Magic tool API to write new effects has been
> migrated from the 'tuxpaint' repo -- where it was a hand-coded
> HTML file in English -- to 'tuxpaint-docs' -- where it is
> a PHP-based HTML file with strings wrapped in gettext().
<snip>
I have begun doing the same to the example C source file that ships
alongside Tux Paint's Magic API documentation, "tp_magic_example.c".
That is, once I'm all done, and if anyone out here is crazy enough to
bother localizing the strings that are being added to the Magic API
docs POT files, things like code comments, strings (tool names and
descriptions), and even variable names ("canvas", "snapshot", etc.)
may be localized. (For the latter you'll want to limit yourself to
valid variable names in the C language, which means no spaces or
punctuation other than underscore... and I'm actually not sure whether
non-ASCII characters, such as "�", are valid...!?)
It's still a work-in-progress. It's basically a PHP file with
<?= gettext() ?> (sometimes inside an sprintf(), which is also
sometimes inside a wordwrap()) around the relevant bits, like so:
...
/*
<?= wordwrap(sprintf(gettext("Here is a comment on how to use the %s function"), "foo()")) ?>
*/
void foo() {
<?php $my_local_var = gettext("my_local_variable"); /* e.g. in Spanish "mi_variable_local"...? */ ?>
int <?= $my_local_var ?>;
for (<?= $my_local_var ?> = 0; <?= $my_local_var ?> < 10; <?= $my_local_var ?>++) {
...
}
}
which would render in the final C file as (in the English version):
/*
Here is a comment on how to use the foo() function
*/
void foo()
int my_local_variable;
for (my_local_variable = 0; my_local_variable < 10; my_local_variable++) {
...
}
}
And perhaps in Spanish, it might be:
/*
Aqu� hay un comentario sobre c�mo usar la funci�n foo()
*/
void foo()
int mi_variable_local;
for (mi_variable_local = 0; mi_variable_local < 10; mi_variable_local++) {
...
}
}
More madness, I know... but I figure if the API documentation can be
localized, there's no reason to suddenly require English comprehension
just to see a small example C file.
(There's already plenty of English baked into programming languages like C.
"void", "float", "int"eger, "print[f]", etc. :) )
-bill!
|