public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Michael Tremer <michael.tremer@ipfire.org>
To: Matthias Fischer <matthias.fischer@ipfire.org>
Cc: development@lists.ipfire.org
Subject: Re: How to handle the new translation method on a live system?
Date: Sat, 28 Nov 2026 14:10:01 +0000	[thread overview]
Message-ID: <214A071B-56FD-480E-8BD3-C88D33AAB87F@ipfire.org> (raw)
In-Reply-To: <393a3f97-4606-4785-bbe8-7b2e9351e7bd@ipfire.org>

Hi Matthias,

thanks for working this out, and for compile-po.sh. Good to know that the .mo files come out bit-identical, that will be useful for testing on a live system.

I would rather not put more effort into squid-graph itself. It is an old, unmaintained Perl tool that parses access.log every five minutes and has its own idea of translations. Instead, I would like to port the functionality into telemetryd, so that the proxy shows up in the new web UI next to the DNS and time server statistics. That fits very well, and the strings then go through the normal translation process.

How we would get the data: Squid already keeps all the counters we need, so there is no need to parse any logs. Its cache manager exposes them over HTTP on the local Squid port (the counters report: client requests, hits, bytes in/out on the client and server side, errors). A new telemetryd source would fetch that once per interval, convert the counters into RRD data and the web UI would draw requests, traffic and hit ratio from there. The only prerequisite is that Squid allows the manager interface from localhost, which I will check in our squid.conf.

I am happy to do this work myself. Would you be happy replacing squid-graph?

Best,
-Michael

> On 27 Nov 2026, at 17:58, Matthias Fischer <matthias.fischer@ipfire.org> wrote:
> 
> Hi,
> 
> in short:
> Many thanks for the hint with 'mgmfmt'. I've found a solution and it works!
> 
> In long:
> E.g., I'm running a rather old tool called 'squid-graph' - unofficial.
> 
> This tools analyses squids 'access.log', writing an 'index.html' and
> some PNG-graphs, showing the current proxy utilization on the Web GUI.
> 
> To do this, every five minutes a script called
> '/usr/bin/squid-graph' is started.
> 
> The problem:
> Nearly all translation strings for 'squid-graphs' are included in this
> script. From the Web GUI a 'sgraph.cgi' then calls an 'index.html' and
> the PNGs to display the results.
> 
> See https://github.com/detach8/squid-graph for details, screenshot is
> attached. Its old, but its hard to give up old habits... ;-)
> 
> How would be the best way to integrate this in the new translation process?
> 
> What I did:
> - On one of my 'Devels', I edited 'tools/update-po' and added the path
> "config/sgraph" to 'my @searchpaths' (line 48).
> 
> This script is started through './make.sh lang' for ""Updating
> the translations of the web user interface...".
> 
> 'update.po' itself tells me (line 22f):
> # Extracts all translatable strings of the web user interface into
> # po/ipfire.pot and merges them into the translations in po/*.po.
> 
> Sounds good.
> 
> So I did the following:
> - Edited all translations in 'squid-graph' and replaced 'lang::tr...'
> with '_(...'
> - Created and added the directory 'config/sgraph' to the searchpath above
> - Copied 'squid-graph' to 'config/sgraph' (found no better way)
> - Finally, I started './make.sh lang'
> - It worked as it should and extracted all 'lang::tr'-strings
> - With some editing and fine-tuning, I added these strings on my build
> system to '.../po/de.po'
> 
> Now I got the source, but how to compile? I needed 'msgfmt' for this.
> Thanks again for the hint.
> 
> I found that the compiling of the *.po-files is done in
> 'lfs/configroot', line 167ff:
> 
> ***SNIP***
> #!/bin/bash
> #
> for i in ../po/*.po; do \
> lang="$$(basename $${i} .po)"; \
> mkdir -p /tmp/usr/share/locale/$${lang}/LC_MESSAGES; \
> msgfmt --check-format -o
> /tmp/usr/share/locale/$${lang}/LC_MESSAGES/ipfire.mo $${i} || exit 1; \
> done
> ***SNAP***
> 
> I wasn't as clever as these few lines - my bash programming is not so
> good - so I decided to do this one by one.
> 
> I ended up with a script I called 'compile-po.sh'. See it attached, but
> please don't laugh - its just doing its job. [And: it needed the
> money...! :-)]
> 
> Important:
> The sources for the Web GUI are read from '../po/*.po', sources for
> 'setup from '../src/setup/po/*.po'. The syntax for 'msgfmt' is easy -
> but you have to follow the order:
> "msgfmt --check-format -o target-path-and-file source-path-and-file".
> 
> In its current state, the script must be located in the
> '.../tools'-directory. After running, I got bit-identical *.mo files
> (compared to a usual build) that can be copied into a running system.
> The whole thing still involves a lot of manual work, but for a start, it
> serves its purpose. I don't need to run a complete build if I want to
> test some new translations or add one on the fly.
> 
> To do this, all I have to do is add the appropriate entries in the
> respective po-file...:
> 
> ***SNIP***
> #: Where does this string come from
> msgid "Some String In The CGI (e.g.)"
> msgstr "What should the translation be?"
> ***SNAP***
> 
> ...and run the compile-script.
> 
> Improvements are possible and welcome... ;-)
> 
> Best
> Matthias
> <Proxy-Diagramme.png><2026-11-27-1-po-files-for-ipfire-Core206.tar.gz><compile-po.sh>



  parent reply	other threads:[~2026-11-28 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 10:55 Matthias Fischer
2026-11-20 16:27 ` Michael Tremer
2026-11-27 17:58   ` Matthias Fischer
2026-11-27 18:01     ` Matthias Fischer
2026-11-28 14:10     ` Michael Tremer [this message]
2026-11-28 16:26       ` Matthias Fischer
     [not found] ` <4jWKzk20n5zTq0T@michael.haj.ipfire.org>
2026-11-20 16:18   ` Matthias Fischer
2026-11-22 12:50   ` Vincent Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=214A071B-56FD-480E-8BD3-C88D33AAB87F@ipfire.org \
    --to=michael.tremer@ipfire.org \
    --cc=development@lists.ipfire.org \
    --cc=matthias.fischer@ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox