Coding is an art, not a science!

If you don't believe me, have a look at what tools *real* coders use...

I'm not talking about emacs, I'm not talking about vi...

I'm talking about the real thing!


Preparing Translatable Strings

I am currently considering using GNU gettext utilities to internationalize b2evolution.

I'm not done reading the docs, but right now I just felt like I needed to work this out:

The gettext manual has this totally valid understanding about preparing translatable string:

Hardcoded string concatenation is sometimes used to construct English strings:

strcpy (s, "Replace ");
strcat (s, object1);
strcat (s, " with ");
strcat (s, object2);
strcat (s, "?");

In order to present to the translator only entire sentences, and also because in some languages the translator might want to swap the order of object1 and object2, it is necessary to change this ...

This sounds very wise... but the "solution" leaves me baffled:

...change this to use a format string:

sprintf (s, "Replace %s with %s?", object1, object2);

Okay... how exactly am I supposed to swap the order of the objects? Swap %s with %s... ? yeah, right... :crazy:

(For those of you familiar with C but not with translation, rememenber that the translator can only act upon the string "Replace %s with %s?", not upon the sprintf statement.)

Update: Doh! Just learnt something kewl about printf syntax! :. Solution is easy:

sprintf (s, "Replace %1$s with %2$s?", object1, object2);

And there's no reason to specify those order numbers until you need to change the order... well, actually there is a reason: give a hint to the translator who "may not" be a printf syntax expert... :!:

Apprendre le calendrier par coeur XX(

Avez vous déjà rencontré quelqu'un qui pouvait vous donner le jour de la semaine pour n'importe quelle date, comme s'il avait appris le calendrier par coeur?

Héhé... ne cherchez plus... il y a un algorythme permettant de faire le calcul de tête (ou presque): Doomsday Algorithm.

Parfaitement inutile, donc indispensable.

Super-Efficient Image Rollovers

hint: clipping ;)