[mythtv-commits] Ticket #8175: Themestrings which contains a newline character are untranslatable

MythTV mythtv at cvs.mythtv.org
Sat Apr 17 02:26:28 UTC 2010


#8175: Themestrings which contains a newline character are untranslatable
---------------------------------------------+------------------------------
 Reporter:  Kenni Lund <kenni@…>             |       Owner:  stuartm 
     Type:  defect                           |      Status:  accepted
 Priority:  minor                            |   Milestone:  0.24    
Component:  MythTV - User Interface Library  |     Version:  head    
 Severity:  medium                           |     Mlocked:  0       
---------------------------------------------+------------------------------

Comment(by Nicolas Riendeau <knight@…>):

 Hi,

 If you can find someway to do it in themestringtool than I agree that it
 would indeed be preferable than to do this sort of string manipulation at
 runtime.

 The \n gets remapped to a real newline by lupdate (which believe \n in
 source code should be remapped to a real newline) and the fix for this
 seems easy enough, add a second backslash before the other one in
 themestringtool so that the .ts file ends up not having real newlines but
 \n instead.

 The con with this though is that it certainly won't look as good in Qt
 linguist (or in a text editor) as the formatting will not clearly show the
 line change.

 The biggest problem is not there however, it's with the non-significant
 spaces added by the XML formatting.

 The only way I could think of this problem could be addressed is by
 imposing restrictions to the themers.

 There are currently strings in some themes which look like this:

              This is a test string
              that is split on many
              lines and which contains
              a lot of non-significant
              spaces which should be
              removed before trying to
              display it. The newlines
              in that string should be
              removed as well because
              they are only there to
              format this text nicely
              in the XML theme file.

 The following code (in themestringtool and in my patch) takes care of this
 by removing all these extraneous spaces:

 // Remove newline whitespace added by
 // xml formatting
 QStringList lines = text.split('\n');
 QStringList::iterator lineIt;

 for (lineIt = lines.begin(); lineIt != lines.end(); ++lineIt)
 {
   (*lineIt) = (*lineIt).trimmed();
 }

 text = lines.join(" ");

 I can't see a way to address this problem anywhere else than at runtime or
 remove support for this from themestringtool, modify the themes and tell
 the themers to stop formatting text this way.

 I said the patch did not have any "adverse" effect on the English
 "translation" but it did have an effect on it. It actually has a positive
 effect on strings formatted that way which are currently not formatted
 correctly, in English, because of all these non-significant spaces.

 Have a nice day!

 Nick

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/8175#comment:5>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list