trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2012

Re: [trinity-devel] Fixing What's This and Tooltip text strings

From: "E. Liddell" <ejlddll@...>
Date: Fri, 30 Mar 2012 08:55:45 -0400
On Tue, 27 Mar 2012 14:54:05 -0700 (PDT)
Darrell Anderson <humanreadable@...> wrote:

> I would like to update branding issues in all of the What's This and Tooltip text strings. Primarily changing KDE -> TDE.
> 
> A challenge is many of the text strings are multiple lines. A simple find/sed one-liner will be insufficient.
> 
> The What's This strings are contained in TQString functions and end with the traditional semi-colon. Additional What's This strings are in XML files enclosed in <whatsthis> and </whatsthis> tags.
> 
> The tool tips are embedded in i18n functions.
> 
> I'm no expert with awk or perl and I'm guessing either is better for addressing this challenge.
> 
> A good way for me to learn some basics about awk or perl is to update these text strings.
> 
> I would appreciate some awk/perl tips or pointers for approaching this mini project.
> 
> Thanks!

(Currently catching up after a couple of days preoccupied with other things)

What kind of tips do you need, exactly?  The perl case for the additional <whatsthis>-
enclosed strings in the XML files is fairly straightforward if <whatsthis> is a straight text
container with no subelements:  just slurp the entire file into a single string, run

$file =~ s/(\<whatsthis\>.*?\b)KDE(.*?\<\/whatsthis\>)/$1TDE$2/gs;

across it a few times (running it only once may not catch cases where a single whatsthis
element contains multiple KDEs), and spit the result back into the file.  Or something
like that.  The above will alter freestanding instances of "KDE" and those at the beginning
of another word, but should leave it alone if it's in the middle or at the end, and will handle
the case where the whatsthis element is split across multiple lines.  To do a case-
insensitive replace, add an i right before the semicolon at the end of the line.

I can probably come up with similar stuff for your other two cases given a couple of
samples of each (location in the git repository plus line numbers works).