summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorAndras Timar <atimar@suse.com>2012-09-14 22:44:28 +0200
committerAndras Timar <atimar@suse.com>2012-09-14 22:48:09 +0200
commitf3b0081044d0a5b98c6c8a5e2bf3dfd84287bc21 (patch)
tree7c704bb6bde3fa069cef05b349c62ed668744f64 /l10ntools
parentfa81ac50dd6613ff9c55d2169538a062a417e89d (diff)
trim leading (and trailing) spaces when extracting help string
and put leading spaces back on merge. It will result in cleaner strings in .po files, and indentation of Basic code examples will be kept more easily. Change-Id: Icdd5cb94069f506ed0b7edf7483ccfd139f296aa
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/helpmerge.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index 8e8d33fae0cb..cbf38fb9e809 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -155,7 +155,7 @@ bool HelpParser::CreateSDF(
rtl::OUString()).
replaceAll(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t")),
- rtl::OUString()));
+ rtl::OUString()).trim());
sBuffer.append( sOUPrj );
sBuffer.append('\t');
if ( !rRoot_in.isEmpty())
@@ -374,8 +374,23 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const rtl::OString& sCur ,
if( pEntrys != NULL)
{
rtl::OString sNewText;
+ rtl::OUString sSourceText(
+ pXMLElement->ToOUString().
+ replaceAll(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\n")),
+ rtl::OUString()).
+ replaceAll(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\t")),
+ rtl::OUString()));
+ // re-add spaces to the beginning of translated string,
+ // important for indentation of Basic code examples
+ sal_Int32 nPreSpaces = 0;
+ sal_Int32 nLen = sSourceText.getLength();
+ while ( (nPreSpaces < nLen) && (*(sSourceText.getStr()+nPreSpaces) == ' ') )
+ nPreSpaces++;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur , true );
rtl::OUString sNewdata(
+ sSourceText.copy(0,nPreSpaces) +
rtl::OStringToOUString(sNewText, RTL_TEXTENCODING_UTF8));
if (!sNewdata.isEmpty())
{