On Wed, Jun 3, 2009 at 3:21 PM, Christian Perrier <[email protected]>wrote:

> Quoting Nguyen Vu Hung ([email protected]):
> > Hi all,
> >
> > I am sorry if this email is not suitable for the list.
> >
> > I am a member of OpenOffice.org Vietnamese translation team.
> > The current translations in the .po files are using brackets like this.
> >
> > « Vietnamese »
> >
> > I want to replace all '«' with '\"' and '»' with '\"' in all the msgstr
> of
> > .po files
> > in a directory, recursively.
> >
> > The constrain here is that I must not touch msgid of any .po files.
> >
> > Is there any way I can do that with translate toolkit?
> >
>
> With the TT, I don't know.
>
> With "standard" gettext tools and sed you probably can.
>
> This is untested but you'll get the point:
>
> msgcat --no-wrap foo.po | \
>       sed '/msgstr \"/s/«/\"/g' | \
>       sed '/msgstr \"/s/»/\"/g' | \
>       msgcat >foo-fixed.po
>

you could probably do this easier with msgfilter which only touches the
translations in msgstr:

msgfilter -i myfile.po sed -e 's/«/"/g' -e 's/»/"/g'

Notice that these sed expressions works on the unescaped content in msgstr,
so you only replace it with " rather than \".

similarly recursively for po files in myfolder:

for f in `find myfolder |grep ".po$"`; do msgfilter -i $f -o $f sed -e
's/«/"/g' -e 's/»/"/g'; done;

Hope this helps!

cheers,
asgeir
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Translate-pootle mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/translate-pootle

Reply via email to