supplement to fixuifiles

Jason Harris kstars at 30doradus.org
Wed Dec 12 17:38:37 GMT 2007


Hello,

I was notified recently by a translator that I have some difficult strings in 
kstars.po, such as the following:

<html><head><meta name="qrichtext" 
content="1" /></head><body style=" white-space: 
pre-wrap; font-family:Sans Serif; font-weight:400; font-style:normal; 
text-decoration:none;"><p style=" margin-top:12px; 
margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; 
text-indent:0px;">You may now download optional data files to enhance 
KStars, such as Messier object images, or a more complete NGC/IC catalog. 
Press the <span style=" font-weight:600;">Download Extra 
Data</span> button to proceed. </p><p style=" margin-top:12px; 
margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; 
text-indent:0px;">You can also use this tool later, by selecting 
<span style=" font-weight:600;">Download data</span> from the 
<span style=" font-weight:600;">File</span> 
menu.</p></body></html>

As you probably know, these blocks result when rich text is used in Qt 
designer.  I was told that the current workaround is to hand-edit the UI 
files, but this definitely seems like something that should be more 
automated.  I have written a python script that will recursively "fix" all 
such HTML blocks to be more legible, such as this:

<html><head></head><body><p>You may now download optional data files to 
enhance KStars, such as Messier object images, or a more complete NGC/IC 
catalog. Press the <span style=" font-weight:600;">Download Extra Data</span> 
button to proceed. </p><p>You can also use this tool later, by selecting 
<span style=" font-weight:600;">Download data</span> from the <span style=" 
font-weight:600;">File</span> menu.</p></body></html>

I can extend the script to replace '<span style=" font-weight:600;"></span>' 
with '<b></b>' as well, but I wasn't sure if this was desirable.

I have attached my script to this message.  Is it possible to insert something 
like this script into the pipeline that extracts strings from the UI files 
for translation?  That way, the correction would happen automatically and 
invisibly.  Or maybe the script could supplement or supersede the existing 
fixuifiles script in kdesdk/scripts.

regards,
Jason

-- 
KStars: KDE Desktop Planetarium
kstars at 30doradus.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prettyuistrings.py
Type: application/x-python
Size: 2163 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071212/d2ef2caf/attachment.bin>


More information about the kde-core-devel mailing list