2013-03-30 04:20 UTC+0100 Viktor Szakats (harbour syenar.net)

* utils/hbmk2/_po_push.hb
    + will now refresh source language .po (.pot) from source code
    + will now save source .po locally
This commit is contained in:
Viktor Szakats
2013-03-30 04:21:23 +01:00
parent 316d6ab161
commit dea79cf720
2 changed files with 29 additions and 6 deletions

View File

@@ -10,6 +10,10 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-03-30 04:20 UTC+0100 Viktor Szakats (harbour syenar.net)
* utils/hbmk2/_po_push.hb
* utils/hbmk2/po/hbmk2.en.po
2013-03-30 03:52 UTC+0100 Viktor Szakats (harbour syenar.net)
+ utils/hbmk2/_po_push.hb
+ added script to upload English source .po file

View File

@@ -1,10 +1,10 @@
/*
* Uploads source .po file to Transifex localization site
* Uploads source .pot file to Transifex localization site
*
* Copyright 2013 Viktor Szakats (harbour syenar.net)
* www - http://harbour-project.org
*
* Requires: curl (built with SSL)
* Requires: curl (built with SSL), Harbour in PATH
* Reference: http://help.transifex.com/features/api/api-v2.1.html
*
*/
@@ -14,17 +14,36 @@
PROCEDURE Main( cLogin )
LOCAL cTemp
LOCAL cContent
IF Empty( cLogin )
cLogin := GetEnv( "HB_TRANSIFEX_LOGIN" ) /* Format: username:password */
ENDIF
? "uploading", "en"
FClose( hb_FTempCreateEx( @cTemp, , , ".pot" ) )
FClose( hb_FTempCreateEx( @cTemp ) )
? "generating pot"
hb_MemoWrit( cTemp, hb_jsonEncode( ;
{ "content" => hb_MemoRead( hb_DirSepToOS( hb_DirBase() + "po/hbmk2.en.po" ) ) } ) )
hb_run( hb_StrFormat( "harbour -q0 hbmk2.prg -j%1$s -i%2$s -s", cTemp, hb_DirSepToOS( hb_DirBase() + "../../include" )) )
? "saving locally"
cContent := StrTran( ;
'#, c-format' + hb_eol() + ;
'msgid ""' + hb_eol() + ;
'msgstr ""' + hb_eol() + ;
'"Project-Id-Version: hbmk2\n"' + hb_eol() + ;
'"Language: en\n"' + hb_eol() + ;
'"MIME-Version: 1.0\n"' + hb_eol() + ;
'"Content-Type: text/plain; charset=UTF-8\n"' + hb_eol() + ;
'"Content-Transfer-Encoding: 8bit\n"' + hb_eol() + hb_eol() + ;
hb_MemoRead( cTemp ), hb_eol(), e"\n" )
hb_MemoWrit( hb_DirSepToOS( hb_DirBase() + "po/hbmk2.en.po" ), cContent )
? "uploading"
hb_MemoWrit( cTemp, hb_jsonEncode( { "content" => cContent } ) )
hb_run( hb_StrFormat( 'curl -s -i -L --user %1$s -X ' + ;
'PUT -d @%2$s -H "Content-Type: application/json" ' + ;