2013-04-01 03:33 UTC+0200 Viktor Szakats (harbour syenar.net)

* src/rtl/hbi18n2.prg
    ! __i18n_potArraySort() fixed to not RTE when no source is present
    + __i18n_potArraySort() tweaked to sort items w/o source info to always
      come before ones with source info
    + __i18n_potArrayClean() wlll now call transformation callback before
      deleting items
    + __i18n_potArrayClean() will now remove the item in question if the
      callback returns any non-string value
    + __i18n_potArrayClean()'s second lKeepVoidTranslations = .F. option will
      now also remove items where the translation is identical to the msg id

  - utils/hbmk2/_po_pull.hb
  - utils/hbmk2/_po_push.hb
  - utils/hbmk2/_md_make.hb
  + utils/hbmk2/hblang.hb
    * merged separate management scripts into one
    + sort pulled .po files before stripping/processing
    ! do not process .po files in place to avoid race conditions
      between parallel script sessions
    * minor tweaks

  * README.md
    ! minor
This commit is contained in:
Viktor Szakats
2013-04-01 04:09:18 +02:00
parent 0aadabafd7
commit 02ebccfcdd
6 changed files with 296 additions and 226 deletions

View File

@@ -321,31 +321,42 @@ STATIC FUNCTION __i18n_ItemToStr( item )
LOCAL cSource := item[ _I18N_SOURCE ]
LOCAL tmp
hb_default( @cSource, "" )
/* first source occurrence */
IF ( tmp := At( " ", cSource ) ) > 0
cSource := Left( cSource, tmp - 1 )
ENDIF
IF ( tmp := RAt( ":", cSource ) ) > 0
cSource := Left( cSource, tmp - 1 ) + Str( Val( SubStr( cSource, tmp + 1 ) ), 10, 0 )
cSource := "~" + Left( cSource, tmp - 1 ) + Str( Val( SubStr( cSource, tmp + 1 ) ), 10, 0 )
ENDIF
RETURN cSource + item[ _I18N_MSGID, 1 ]
FUNCTION __i18n_potArrayClean( aTrans, lSource, lEmptyTranslations, bTransformTranslation )
FUNCTION __i18n_potArrayClean( aTrans, lKeepSource, lKeepVoidTranslations, bTransformTranslation )
LOCAL item
LOCAL lEmpty
LOCAL cString
hb_default( @lSource, .T. )
hb_default( @lEmptyTranslations, .T. )
hb_default( @lKeepSource, .T. )
hb_default( @lKeepVoidTranslations, .T. )
FOR EACH item IN aTrans DESCEND
IF ! lEmptyTranslations
IF HB_ISEVALITEM( bTransformTranslation )
FOR EACH cString IN item[ _I18N_MSGSTR ]
cString := Eval( bTransformTranslation, cString, item[ _I18N_MSGID, cString:__enumIndex() ] )
IF ! HB_ISSTRING( cString )
hb_ADel( aTrans, item:__enumIndex(), .T. )
LOOP
ENDIF
NEXT
ENDIF
IF ! lKeepVoidTranslations
lEmpty := .T.
FOR EACH cString IN item[ _I18N_MSGSTR ]
IF ! Empty( cString )
IF ! Empty( cString ) .AND. !( cString == item[ _I18N_MSGID, cString:__enumIndex() ] )
lEmpty := .F.
EXIT
ENDIF
@@ -355,12 +366,7 @@ FUNCTION __i18n_potArrayClean( aTrans, lSource, lEmptyTranslations, bTransformTr
LOOP
ENDIF
ENDIF
IF HB_ISEVALITEM( bTransformTranslation )
FOR EACH cString IN item[ _I18N_MSGSTR ]
cString := Eval( bTransformTranslation, cString )
NEXT
ENDIF
IF ! lSource
IF ! lKeepSource
item[ _I18N_SOURCE ] := ""
ENDIF
NEXT