From f18ce81c0b5d3a26af2d4be1ef2362414ecfb471 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 1 Apr 2013 01:30:23 +0200 Subject: [PATCH] 2013-04-01 01:28 UTC+0200 Viktor Szakats (harbour syenar.net) * utils/hbmk2/_po_pull.hb ! fixed wrong EOL forming after prev % consolidated newline transformation into new doctoring calling + fixing EOL+space into EOL in translated text --- ChangeLog.txt | 6 ++++++ utils/hbmk2/_po_pull.hb | 16 +++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 991b645216..90c26ec3d5 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,12 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-04-01 01:28 UTC+0200 Viktor Szakats (harbour syenar.net) + * utils/hbmk2/_po_pull.hb + ! fixed wrong EOL forming after prev + % consolidated newline transformation into new doctoring calling + + fixing EOL+space into EOL in translated text + 2013-04-01 01:14 UTC+0200 Viktor Szakats (harbour syenar.net) * include/harbour.hbx * src/rtl/hbi18n2.prg diff --git a/utils/hbmk2/_po_pull.hb b/utils/hbmk2/_po_pull.hb index 097640b213..fe00bb1ce8 100644 --- a/utils/hbmk2/_po_pull.hb +++ b/utils/hbmk2/_po_pull.hb @@ -41,14 +41,13 @@ PROCEDURE Main( cLogin ) cLogin, cProject, hb_FNameName( cMain ), cLang, cTemp ) ) IF hb_jsonDecode( GetJSON( hb_MemoRead( cTemp ) ), @json ) > 0 - hb_MemoWrit( cPO_Dir + hb_FNameName( cMain ) + "." + cLang + ".po", DoctorContent( json[ "content" ] ) ) + hb_MemoWrit( cPO_Dir + hb_FNameName( cMain ) + "." + cLang + ".po", json[ "content" ] ) /* should only do this if the translation is primarily done on Transifex website. This encouraged and probably the case in practice. Delete source information, delete empty translations and apply some automatic transformation for common translation mistakes. */ PO_Clean( cPO_Dir + hb_FNameName( cMain ) + "." + cLang + ".po", .F., .F., @DoctorTranslation() ) - FToNativeEOL( cPO_Dir + hb_FNameName( cMain ) + "." + cLang + ".po" ) ELSE ? "API error" ENDIF @@ -58,14 +57,13 @@ PROCEDURE Main( cLogin ) RETURN -STATIC FUNCTION FToNativeEOL( cFile ) - RETURN hb_MemoWrit( cFile, StrTran( hb_MemoRead( cFile ), e"\n", hb_eol() ) ) - -STATIC FUNCTION DoctorContent( cString ) - RETURN StrTran( cString, hb_UChar( 0x23CE ), "\n" ) /* convert RETURN SYMBOL used by Transifex for NEWLINE */ - STATIC FUNCTION DoctorTranslation( cString ) - RETURN Unspace( AllTrim( cString ) ) + + cString := Unspace( AllTrim( cString ) ) + cString := StrTran( cString, hb_UChar( 0x23CE ), e"\n" ) + cString := StrTran( cString, e"\n ", e"\n" ) + + RETURN cString /* Converts multiple spaces to just one */ STATIC FUNCTION Unspace( cString )