From 040cb6b16537cbdae44c55894b386f59a744384e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 2 Apr 2013 23:44:39 +0200 Subject: [PATCH] final touches after uploading most core lang modules --- ChangeLog.txt | 5 +++++ tests/lang2po.hb | 46 +++++++++++++++++++++++++++++++++------------- tests/po2lang.hb | 6 +++--- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5e5b51d3cf..9296d130e0 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -10,6 +10,11 @@ * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment */ +2013-04-02 23:44 UTC+0200 Viktor Szakats (harbour syenar.net) + * tests/lang2po.hb + * tests/po2lang.hb + ! final touches after uploading most core lang modules + 2013-04-02 22:29 UTC+0200 Viktor Szakats (harbour syenar.net) * src/lang/l_hu.c + translated one missing item diff --git a/tests/lang2po.hb b/tests/lang2po.hb index 1af4c647dc..a0e06bdb4a 100644 --- a/tests/lang2po.hb +++ b/tests/lang2po.hb @@ -73,7 +73,7 @@ STATIC FUNCTION CoreLangList() cName := SubStr( cName, Len( "HB_LANG_" ) + 1 ) IF Len( cName ) != 5 .AND. ; ! "|" + cName + "|" $ "|RUKOI8|UAKOI8|ZHB5|ZHGB|" - AAdd( aList, cName ) + AAdd( aList, Lower( Left( cName, 2 ) ) + SubStr( cName, 3 ) ) ENDIF ENDIF NEXT @@ -102,15 +102,12 @@ STATIC FUNCTION Meta() hMeta[ "Content-Type:" ] := "text/plain; charset=UTF-8" hMeta[ "Content-Transfer-Encoding:" ] := "8bit" - cMeta := '"' + hb_eol() + cMeta := "" FOR EACH meta IN hMeta - cMeta += ; - '"' + ; - meta:__enumKey() + ; - " " + ; - meta + ; - "\n" + ; - iif( meta:__enumIsLast(), "", '"' + hb_eol() ) + cMeta += meta:__enumKey() + " " + meta + IF ! meta:__enumIsLast() + cMeta += e"\n" + ENDIF NEXT RETURN cMeta @@ -129,12 +126,35 @@ STATIC FUNCTION Item( cOri, cTrs, nPos ) LOCAL cComment := Comment( nPos ) - RETURN hb_StrFormat( ; + RETURN ; iif( Empty( cComment ), "", "# " + cComment + hb_eol() ) + ; "#, c-format" + hb_eol() + ; - 'msgid "%1$s"' + hb_eol() + ; - 'msgstr "%2$s"' + hb_eol() + ; - hb_eol(), iif( Len( cOri ) == 0 .AND. nPos != 0, "{" + StrZero( nPos, 3, 0 ) + "}", cOri ), cTrs ) + "msgid " + ItemString( iif( Len( cOri ) == 0 .AND. nPos != 0, "{" + StrZero( nPos, 3, 0 ) + "}", cOri ) ) + ; + "msgstr " + ItemString( cTrs ) + hb_eol() + +STATIC FUNCTION ItemString( cString ) + + LOCAL cResult := "" + LOCAL line + + LOCAL aLine := hb_ATokens( cString, e"\n" ) + + IF Len( aLine ) > 1 + cResult += '""' + hb_eol() + ENDIF + + FOR EACH line IN aLine + cResult += '"' + ConvToC_2( line ) + IF ! line:__enumIsLast() + cResult += "\n" + ENDIF + cResult += '"' + hb_eol() + NEXT + + RETURN cResult + +STATIC FUNCTION ConvToC_2( cStr ) + RETURN hb_StrReplace( cStr, { '"' => '\"' } ) STATIC FUNCTION Comment( nPos ) diff --git a/tests/po2lang.hb b/tests/po2lang.hb index a94b3a795f..06f02c409c 100644 --- a/tests/po2lang.hb +++ b/tests/po2lang.hb @@ -14,12 +14,12 @@ PROCEDURE Main_po2lang() - PO_2_C( "hu.po", "l_hu.c", "hu" ) - PO_2_C( "el.po", "l_el.c", "el" ) + POToLang( "hu.po", "l_hu.c", "hu" ) + POToLang( "el.po", "l_el.c", "el" ) RETURN -STATIC FUNCTION PO_2_C( cFileIn, cFileOut, cLang ) +STATIC FUNCTION POToLang( cFileIn, cFileOut, cLang ) LOCAL aTrans LOCAL cErrorMsg