On Wed, 06 May 2009, Szak�ts Viktor wrote:

Hi,

> Sounds like a useful option. There is one problem again though:
> Incremental builds. In this mode -j+ would only create .pots for files
> actually recompiled, while we'd need the full set in order to make
> it work with current autotrans logic. Here maybe reversing the logic
> so that existing .po becomes the main input and merged .pots are
> processed into the existing one by adding new items, and optionally
> deleting no longer existing items, could give better results.
[...]
> See my above thoughs. Do you think it's possible to do the 'reverse'
> logic I was referring to? To put it simply, I'd like to be able to update
> my full .po (containing translation) with one simple .pot file. In this
> mode only new strings should be added. In another (full-sync) mode,
> which can only occure with merged .pot files, deleted items are
> also dropped (this is basically what we already have). So what we'd
> need is a new method to update .po with one source .pot.

I think that you missed one think. You do not have to use autotrans
at all. The functionality you are asking have existed from beginning
and it's simple -m option. The only one think you have to  make is:

   hbi18n -m mergedtranslation.{pot,po} <new_pot_files,...>

and inside mergedtranslation.{pot,pot} you will have all existing
translation and if sth new has appeared in <new_pot_files,...> it
will be added to mergedtranslation.{pot,po}.
The -m option works like -a and it tries to save any existing translations
in any of the given .po[t] files.

> [ Here the compromise is that the .po file will contain even deleted
> strings until we don't issue a full sync, but in practice this seems to
> be okay to me. ]

Exactly and this is the result of above command. It's also possible that
line numbers will be replicated when translation strings will be moved
in source code due to some other modifications.
If you want to remove all garbage information like old unused translations
then it's enough to make:
   hbi18n -a cleanmergedtrans.{pot,po} mergedtranslation.{pot,po,hbl}

Maybe I'm missing sth but for me it looks that you already have everything
what you are asking for.


There is also one thing related to -j+ option we should discuss.
Should it merge existing and new data or only append new one?
The merge can be time consumed because compiler will have to open
existing files and decode all existing strings then append new ones
respecting already existing strings and translations (we will have
to store also existing translations) and then the whole file will
have to be generated from scratch. For very long .pot files it can
take a lot of time reducing the compilation performance.
We can also append new information without decoding the old one.
In such case we should only add internal merging for 1-st given .pot
file, f.e. LoadFiles() should be modified a little bit:

STATIC FUNCTION LoadFiles( aFiles )
   LOCAL aTrans, aTrans2
   LOCAL hIndex
   LOCAL cErrorMsg
   LOCAL n

   aTrans := {}
   FOR n := 1 TO Len( aFiles )
      aTrans2 := __I18N_potArrayLoad( aFiles[ n ], @cErrorMsg )
      IF aTrans2 == NIL
         ErrorMsg( cErrorMsg )
      ENDIF
      __I18N_potArrayJoin( aTrans, aTrans2, @hIndex )
   NEXT

   RETURN aTrans

As you can see the code is even simpler though it has one additional call
to __I18N_potArrayJoin(). Anyhow it should not be very expensive in
comparison to other operations. But above gives also yet another feature.
You can simply append many different .pot files into single one, f.e.
   cat *.pot > all_trans.po
and then make:
   hbi18n -m all_trans.po
to merge all repeated translations inside all_trans.po so we will have
additional functionality.

best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to