Asking the user for a text template

Rolf Eike Beer kde at
Thu May 6 18:13:52 BST 2010


I'm just trying to get the last feature bits of KGpg for 4.5 polished. One 
thing I did not pay any attention to is a text template the user should enter 
if he sends an automated mail. The idea is that KGpg will sign a bunch of ids 
at once and will send a mail out with the signed id using the text. Within the 
text there should be some placeholders to make the text less static.

A very simple example could be:

== snip ==

I'm sending you your key %KEYID.

Have fun with it.
== snap ==

And then I would so some simple search and replace on those variables and 
replace them with the texts for that particular id. This would basically be 
what you can see with in the mail templates of KMail for example.

My questions are:

-is it a good idea to make the placeholder names itself translatable? So this 
would be %MEINNAME instead of %MYNAME in German. In KMail those names are not 
translated. I don't mind but for non-English people that looks a bit strange 
and they may not even know what %QUOTE is.

-which is the widget of choice to use for that kind of thing? KTextEdit?

-where do I put the standard template? Just enter it into the widget? Put it 
somewhere in the code and assign it? Put it as default string on the KConfig 
option that will save the string at the end (probably best)?

-how do I deal best with translated placeholders? My initial idea would be to 
say that they may only contain uppercase ASCII characters, everything else 
would be used as delimiter. This makes dealing with translated placeholders 
easier as in $StrangeLanguage MYNAME would be translated to NAMEFOO and IDNAME 
to NAMEFOOBAR. But that doesn't look like a too clever idea as half of the 
planet is not using ASCII as (part of) their native character set. What to do 
then? Another idea would be to use %MYNAME% as the placeholder names.

-where do I document the restrictions to the placeholder names best for 
translators, e.g. "no percent signs in placeholder names". In the context of 
each replacement string? In a context to the editor widget? Somewhere 
completely different?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the kde-core-devel mailing list