[Libreoffice] [REVIEW] Easy patch on l10ntools

Eike Rathke erack at redhat.com
Tue Jan 3 12:51:23 PST 2012


Hi Andras,

On Tuesday, 2012-01-03 20:09:42 +0100, Andras Timar wrote:

> >> diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
> >> @@ -1475,7 +1475,7 @@ void Export::InsertListEntry( const ByteString &rText,
> >> const ByteString &rLine )
> >>              (*pCurEntry)[ SOURCE_LANGUAGE ] = rLine;
> >>          }
> >>          else
> >> -            (*pCurEntry)[ SOURCE_LANGUAGE ] = rLine;
> >> +            (*pCurEntry)[ SOURCE_LANGUAGE ] = rText;
> >>
> >>          pList->NewSourceLanguageListEntry();
> >>      }
> >>
> >> Your opinion ?
> >
> > Makes sense, especially when seen with context of the block immediately
> > above:
> >
> >    // For paired list use the line to set proper lid
> >    if( nList == LIST_PAIRED ){
> >        (*pCurEntry)[ m_sListLang ] = rLine;
> >    }else
> >        (*pCurEntry)[ m_sListLang ] = rText;
> >
> 
> On the other hand, if it changes the behaviour that we got used to, it
> may break localizations. I'd prefer to have a full code analysis.

Fair enough. Let's see.. we are in
void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
that's called from Export::Execute() where rLine contains the entire
resource line and rText the translatable text extracted.

For paired lists the entire line is added as an entry to
(*pCurEntry)[m_sListLang] that contains brackets, pair.first (the
translatable text), pair.second (usually a defined named numeric
constant) and separators, e.g.

    < "Text" ; NAME ; > ;

For Export::isSourceLanguage(m_sListLang) (read: m_sListLang equals
"en-US") then (*pCurEntry)[SOURCE_LANGUAGE] is set to the entire line
where SOURCE_LANGUAGE=="en-US", effectively overwriting the previous
(*pCurEntry)[m_sListLang], no matter if it's a paired list or something
else.

If it's not a paired list's entry the line may look like

    "Text" ;


Maybe you can squeeze some sense out of that ;-)


If the current behavior is to remain, then

    if ( Export::isSourceLanguage( m_sListLang ) ) {
-       if( nList == LIST_PAIRED ){
-           (*pCurEntry)[ SOURCE_LANGUAGE ] = rLine;
-       }
-       else
-           (*pCurEntry)[ SOURCE_LANGUAGE ] = rLine;
+       (*pCurEntry)[ SOURCE_LANGUAGE ] = rLine;

        pList->NewSourceLanguageListEntry();
    }

would do.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GnuPG key 0x293C05FD : 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120103/739cb846/attachment.pgp>


More information about the LibreOffice mailing list