Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Tool to manage msgcat::mc lines in source code

30 views
Skip to first unread message

Gerhard Reithofer

unread,
Sep 21, 2019, 8:08:05 AM9/21/19
to
Hi Developers,
in the meantime I became a friend of msgcat files and I create much more
localized programms.

My problem is that a longer lasting develop phase creates many new or
modified msgcat entries.
I got a tip how to notify abount missing translateion strins (many
thanks to c.l.t) but I'd like a method to extract all relevant lines
from TCL source files.

My current shell script approach often fails on interpreting quoted
entries due to different quoting mechanisms of shell tools like grep or
awk and TCL (e. g. line continuation \\)'.

Even if I get all or most used strings from TCL source file the
countercheck if all entries in msg files still match the source code
entries.
Therefore I'd like to ask how you master this "problem" or if someone
knows already existing tools for that.

My dream would be a "msgcat-diff" tool in both directions ;-)

TIA,
Gerhard

--
Gerhard Reithofer - Techn. EDV Reithofer - http://www.tech-edv.co.at

Brad Lanam

unread,
Sep 21, 2019, 9:04:40 AM9/21/19
to
I have various scripts to create the .msg and the .po file from my source
(I wrote that in Tcl rather than sh, as the quoting issues are easier),
to convert .po files to .msg files, to convert .msg files to .po files.

The problem is, it's quite specific to my application and to the
specific manner in which I am using msgcat.

All sorts of fun with regexes (my application uses a proc called _GT (gettext)
to localize the messages) (just showing for fun, I don't think this will
be useful to anyone):

set matches [regexp -all -inline -lineanchor {\[_GT(?:ns)?[\s\\]*\{([^\}]*)\}[\s\\]*(?:(::[a-z:]*)[\s\\]*)?(\{[^\}]*\}|[^ \]]*|"[^"]*")} $txt]

It is possible to do.

Robert Heller

unread,
Sep 21, 2019, 10:44:15 AM9/21/19
to
At Sat, 21 Sep 2019 14:06:21 +0200 Gerhard Reithofer <gerhard....@tech-edv.co.at> wrote:

>
> Hi Developers,
> in the meantime I became a friend of msgcat files and I create much more
> localized programms.
>
> My problem is that a longer lasting develop phase creates many new or
> modified msgcat entries.
> I got a tip how to notify abount missing translateion strins (many
> thanks to c.l.t) but I'd like a method to extract all relevant lines
> from TCL source files.

*I* use standard xgettext (part of the gettext package), with -L Tcl. I also
define a set of Tcl procs: _m, _mx, and _, and are careful about always using
double quotes (") around localization strings. This seems to work well.

See: https:/github.com/RobertPHeller/ModelRRSystem for the code eg Makefiles,
etc.

>
> My current shell script approach often fails on interpreting quoted
> entries due to different quoting mechanisms of shell tools like grep or
> awk and TCL (e. g. line continuation \\)'.
>
> Even if I get all or most used strings from TCL source file the
> countercheck if all entries in msg files still match the source code
> entries.
> Therefore I'd like to ask how you master this "problem" or if someone
> knows already existing tools for that.
>
> My dream would be a "msgcat-diff" tool in both directions ;-)
>
> TIA,
> Gerhard
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
hel...@deepsoft.com -- Webhosting Services

Gerhard Reithofer

unread,
Sep 22, 2019, 6:08:06 AM9/22/19
to
Hello Robert,

On Sat, 21 Sep 2019, Robert Heller wrote:

> At Sat, 21 Sep 2019 14:06:21 +0200 Gerhard Reithofer <gerhard....@tech-edv.co.at> wrote:

...

> *I* use standard xgettext (part of the gettext package), with -L Tcl. I also
> define a set of Tcl procs: _m, _mx, and _, and are careful about always using
> double quotes (") around localization strings. This seems to work well.
>
> See: https:/github.com/RobertPHeller/ModelRRSystem for the code eg Makefiles,
> etc.

Thank you, I'm taking a look.

Without having done it, my approach was to extract it once from the
source and later calculating just the differences. Usually small changes
are made later and if you "forget" to update the message files it's hard
to realize that aomething has changed and what exaclty.

But maybe extracting the complete messages could be a satisfactorily
method also.

THX,

Gerhard Reithofer

unread,
Sep 22, 2019, 6:08:06 AM9/22/19
to
Hi Brad,

On Sat, 21 Sep 2019, Brad Lanam wrote:

> On Saturday, September 21, 2019 at 5:08:05 AM UTC-7, Gerhard Reithofer wrote:

...

> > Therefore I'd like to ask how you master this "problem" or if someone
> > knows already existing tools for that.
> >
> > My dream would be a "msgcat-diff" tool in both directions ;-)
>
> I have various scripts to create the .msg and the .po file from my source
> (I wrote that in Tcl rather than sh, as the quoting issues are easier),
> to convert .po files to .msg files, to convert .msg files to .po files.

I'm currently thinking about port my not so well working scripts to Tcl
too.

> All sorts of fun with regexes (my application uses a proc called _GT (gettext)
> to localize the messages) (just showing for fun, I don't think this will
> be useful to anyone):
>
> set matches [regexp -all -inline -lineanchor {\[_GT(?:ns)?[\s\\]*\{([^\}]*)\}[\s\\]*(?:(::[a-z:]*)[\s\\]*)?(\{[^\}]*\}|[^ \]]*|"[^"]*")} $txt]

Looks similar to my tries ;-)

THX,

Robert Heller

unread,
Sep 22, 2019, 9:28:29 AM9/22/19
to
I do everything with Makefiles, so everytime I rebuild things it does whatever
is needful. Eg if the source code is newer, the .pot file(s) are rebuilt, then
the .msg file(s) are rebuilt, etc. All automagically.

>
> THX,
0 new messages