Hi,

Thanks for your answer, it was really helpful. See more details inline.

On 02/26/2010 01:40 AM, Alaa Abd El Fattah wrote:
> On Thu, 25 Feb 2010 14:16:17 +0900
> Martin André<[email protected]>  wrote:
>
>> Is there an easy method to tell Pootle that my files have to be
>> processed through po2prop before the commit?
>
> yes there is Mozilla contributed a "hooks" feature to pootle where you
> can write scripts to be run before or after certain events.
>
> you need to create a python file inside the pootle/scripts/ directory.
> with filename being the same as your project code.

I was wondering how to use these hooks, now I have the answer :)
Maybe a page on the wiki will be helpful?

> functions inside that file named after the hooks get called when the
> corresponding event happens (initialize, precommit, postcommit,
> preupdate or postupdate).
>
> check pootle/scripts/sumo.py for example hooks and
> pootle/scripts/hooks.py for the implementation details.

I've modified sumo.py to my needs. Works well. However, there is a small 
problem in local_apps/pootle_app/models/translation_project.py. The 
result of the "preupdate" hook is ignored and the wrong file is updated 
(the internal pootle file, not in version control). As a quick hack, 
I've simply changed the call to:
filetoupdate = hooks.hook(self.project.code, "preupdate", store.file.path)

I've no experience in python, so I won't be able submit a proper patch.

> we never used this feature in translate (though we think it's a cool
> idea) and we don't actively test it. so hopefully someone from mozilla
> will offer some help here.
>
> on a longer term these hooks won't be needed for properties files,
> the upcoming 2.1 version of Pootle will support Java properties as well
> as php arrays, QT ts, TMX, TBX and various subtitles formats.
>
> you can already test this functionality by checking latest svn trunk,
> but it is still far from ready. (feedback and patches are most
> welcome :-)

Awesome! I've just played a bit with this new functionality, looks very 
promising.

Martin

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Translate-pootle mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/translate-pootle

Reply via email to