linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Robert White" <rwhite@casabyte.com>
To: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>,
	"'Ruth Ivimey-Cook'" <Ruth.Ivimey-Cook@ivimey.org>,
	<linux-kernel@vger.kernel.org>
Subject: RE: kernel support for non-english user messages
Date: Thu, 10 Apr 2003 13:41:29 -0700	[thread overview]
Message-ID: <PEEPIDHAKMCGHDBJLHKGMEPICGAA.rwhite@casabyte.com> (raw)
In-Reply-To: <A46BBDB345A7D5118EC90002A5072C780BEBA768@orsmsx116.jf.intel.com>

It is tautologically true that every printk starts with a format string, and
that "really" the kernel has no business "switching languages" on the fly.
That is, like selecting the chipset, the language the kernel should express
it self ought to be selected at compile time.

In essence, the translations have to be done earlier in the process instead
of later.  Having or needing a tool to read the log won't help someone
trying to diagnose a problem where a tool isn't in place and the storage
requirements for after-the-fact to see and use the output become
unreasonable.  (It's just not telnet/shell friendly.)

(being innocent of intent, for a moment, i.e. this isn't a recommendation at
this time, just a though experiment...)

Consider a tool that scans any source file and collects up the literal
strings of every printk encountered and tosses them into a static array,
"CHAR_TYPE * KernelMessage[] = { "whatever", "whatever"...};" then replaces
"printk("whatever",...);" with "printk(KernelMessage[0],...);"

subsequent runs of this theoretical tool will take any new prink(s) found
and add them to the list.

For completeness, any KernelMessage subscripts never used (cause the printk
was removed) would get burped out of the sequence at re-expression time.

Once that was done to any/every module, source, etc. the person wishing
translate a fragment needs only go into that file, and a branching define,
and translate the array of messages into the language of their intent.

Now the kernel "naturally" speaks the target language.

The Flaws however:

1) Needs this magic tool.
2) Needs each developer to support the tool.
3) Removes the comment-like value of the messages in the text because you
would have to cross-reference the KernelMessage subscript during development
to see what the program would try to output.
4) Each language would need a maintainer.  (i.e. want a French and a Spanish
kernel you need the French language manager and a Spanish language manager)
5) It's not patch friendly.  (Two people separately add a prink and run the
tool, now two different texts are intended for say KernelMessage[140] in
exit.c) which means un-official patches need to be not-language-enabled
which in turn means that the tool needs to be kept under guard to prevent
misuse etc.
6) Header Problems.  (printk's in headers would force each such header to
have it's own dedicated non-static  message array in a separate source file.

(and so on)

=====

Given that the above is actually the "logically most direct" solution set,
and every step you take further away from modifying the source and compiling
up a single-desired-target-language kernel induces non-trivial loss of
information/clarity at substantial analysis-time expense, I suspect that the
whole problem of "really" making the kernel multi-lingual is NP Complete.

=====

Now consider that any "regular expression or whatever" post processing that
someone might want to put into klogd is a fixed cost expense at runtime, but
in theory most runtime events are successes, one can conclude that that cost
really should only be paid only when someone is actually looking at the
messages.

That naturally infers that the translation shouldn't happen in klogd, but
instead much later at evaluation time.

If you push the evaluation-time (human reading etc) hypothesis to its
conclusion, and fold in the need to manage the per-language effort
coherently, you are led almost inexorably to an external "kernel message
translator" project.

This project would have a generic base and a per-language specialization.

The translator would have two phases, a harvester phase that would literally
collect up all the likely output strings from the entire kernel tree and
drop them into a data file.  Some sort of hashing should be done to find new
and old strings so as to preserve prior runs etc.  The file should also be
able to reasonably find/define the substitution engine for any given message
because it will have the in-place substitution markers (e.g. "%s");

The expressor would take that file and a companion file that listed target
translations, and then do the translation.  The expressor would only be run
when a person was interested in the output.  It would, of course, be fed the
contents of /var/log/messages or wherever the klogd is sending things.  For
people who MUST HAVE the translations real-time, klogd would/could be wired
up to pipe its output through the translator when necessary.

Untranslated lines would pass through unchanged.

A optional third part would be an editor that brought up the two files (the
source hash and the current translation for a language, and let someone who
could translate the strings, enter the well formed desired output with value
markers from the substitution engine.  (e.g. "foo:<value1>" would set
$1=value1 in the extraction engine and then substitute it into the constant
target "blah blah $1 blah", where blah is a real useful text in the target
language. 8-)

In short, The task really requires a heinous post processor, a language
maintainer per target language, and such a project should *NOT* be part of
the kernel tree or it will be trashed over time.

Rob.

-----Original Message-----
From: linux-kernel-owner@vger.kernel.org
[mailto:linux-kernel-owner@vger.kernel.org]On Behalf Of Perez-Gonzalez,
Inaky
Sent: Thursday, April 10, 2003 12:22 PM
To: 'Ruth Ivimey-Cook'; 'linux-kernel@vger.kernel.org'
Subject: RE: kernel support for non-english user messages




> From: Ruth Ivimey-Cook [mailto:Ruth.Ivimey-Cook@ivimey.org]
>
> >This is _not_ like any i18n support.  The problem is that normal
>
> Agreed. How about changing the way printk works, so that instead of
> combining the format string, it just "prints" its args:
>
> printk("%s: name %p is %d\n", name, ptr, val);
>
> results in the following in the kernel buffer:
>
> "%s: name %p is %d\n", "stringval", 0x4790243, 44

Debugging a non-klogd enabled kernel would be a pain - alas, having some
preprocessing tool, this can be done without that modification. If you
know the format string (from the sources), given a printed message, a
regexp could extract the parts that need translation.

Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own
(and my fault)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  reply	other threads:[~2003-04-10 20:30 UTC|newest]

Thread overview: 122+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-10 19:21 kernel support for non-english user messages Perez-Gonzalez, Inaky
2003-04-10 20:41 ` Robert White [this message]
2003-04-11  9:21   ` kernel support for non-English " Riley Williams
2003-04-11 20:49     ` Robert White
2003-04-11 22:53       ` Riley Williams
2003-04-15  3:44         ` Robert White
2003-04-15 11:08           ` Alan Cox
2003-04-15 11:08           ` Alan Cox
2003-04-15 14:07           ` Timothy Miller
2003-04-11 21:04     ` Ruth Ivimey-Cook
2003-04-11 21:31       ` Daniel Stekloff
  -- strict thread matches above, loose matches on Subject: below --
2003-04-14 21:27 Chuck Ebbert
2003-04-12 20:31 Chuck Ebbert
2003-04-14  9:07 ` Denis Vlasenko
2003-04-12 16:47 Chuck Ebbert
2003-04-12 15:20 Chuck Ebbert
2003-04-12 15:34 ` Alan Cox
2003-04-12 17:22   ` Robert P. J. Day
2003-04-13  3:59     ` Martin J. Bligh
2003-04-13  6:21   ` John Bradford
2003-04-12  9:52 Chuck Ebbert
2003-04-11 23:38 Chuck Ebbert
2003-04-11 23:36 Jim Keniston[UNIX]
2003-04-11 22:21 Chuck Ebbert
2003-04-11 22:53 ` Martin J. Bligh
2003-04-12  7:55   ` John Bradford
2003-04-12  7:48 ` John Bradford
2003-04-14 11:40 ` Denis Vlasenko
2003-04-14 12:55   ` John Bradford
2003-04-14 17:29     ` Linus Torvalds
2003-04-14 18:15       ` John Bradford
2003-04-14 23:04       ` Felipe Alfaro Solana
2003-04-15 13:21       ` Alex Combas
2003-04-15 18:02       ` Eric Altendorf
2003-04-17 13:46         ` Alan Cox
2003-04-17 15:07         ` Randolph Bentson
2003-04-17 18:49           ` Eric Altendorf
2003-04-14 13:18   ` Sean Neakums
2003-04-14 14:23   ` Valdis.Kletnieks
2003-04-16  5:03     ` Denis Vlasenko
     [not found] <A46BBDB345A7D5118EC90002A5072C780BEBA7DD@orsmsx116.jf.inte l.com>
2003-04-11 20:55 ` kernel support for non-english " Ruth Ivimey-Cook
2003-04-11 20:02 Perez-Gonzalez, Inaky
2003-04-11 16:57 kernel support for non-English " Chuck Ebbert
2003-04-11 17:38 ` Richard B. Johnson
2003-04-11 18:10 ` Matti Aarnio
2003-04-11 14:52 Paolo Ciarrocchi
2003-04-11 13:17 Chuck Ebbert
2003-04-11 13:40 ` John Bradford
2003-04-16  1:59   ` Gerrit Huizenga
2003-04-16 14:28     ` Timothy Miller
2003-04-16 14:37       ` Alan Cox
2003-04-16 16:20         ` Timothy Miller
2003-04-16 17:04       ` Bruce Harada
2003-04-16 18:34         ` Timothy Miller
2003-04-16 18:37           ` Bruce Harada
2003-04-11 14:37 ` Richard B. Johnson
2003-04-11 16:00 ` Linus Torvalds
2003-04-12  8:22 ` Kai Henningsen
2003-04-12 11:08   ` John Bradford
     [not found] <20030409051006$1ecf@gated-at.bofh.it>
     [not found] ` <20030409081011$5257@gated-at.bofh.it>
     [not found]   ` <20030409221017$6c98@gated-at.bofh.it>
     [not found]     ` <20030409225009$2558@gated-at.bofh.it>
     [not found]       ` <20030410014009$78fb@gated-at.bofh.it>
     [not found]         ` <20030410200019$3e8f@gated-at.bofh.it>
     [not found]           ` <20030410202016$7d48@gated-at.bofh.it>
2003-04-11 11:29             ` kernel support for non-english " Tim Connors
2003-04-11 10:10 Chuck Ebbert
2003-04-10 23:23 Chuck Ebbert
2003-04-10 22:13 Chuck Ebbert
2003-04-10 22:33 ` Stephen Hemminger
2003-04-10 21:20 Perez-Gonzalez, Inaky
2003-04-10 22:06 ` Andreas Dilger
2003-04-11  7:38   ` Ville Herva
2003-04-10 20:54 Chuck Ebbert
2003-04-10 21:08 ` Bernd Petrovitsch
2003-04-10 10:47 Ruth Ivimey-Cook
2003-04-09 23:31 Jim Keniston[UNIX]
2003-04-10 19:01 ` Alan Cox
2003-04-11  9:21   ` kernel support for non-English " Riley Williams
2003-04-11 12:16     ` Alan Cox
2003-04-11 13:39       ` John Bradford
2003-04-11 13:11         ` Alan Cox
2003-04-11 14:48           ` John Bradford
2003-04-09 19:25 kernel support for non-english " Perez-Gonzalez, Inaky
2003-04-09 19:01 Perez-Gonzalez, Inaky
2003-04-09  5:02 Frank Davis
2003-04-09  5:29 ` Oliver Neukum
2003-04-09  5:50   ` Frank Davis
2003-04-09  9:37     ` Bernd Petrovitsch
2003-04-09 11:04   ` Alan Cox
2003-04-09  5:53 ` Andreas Dilger
2003-04-09  8:08 ` Matti Aarnio
2003-04-09  9:33   ` Oliver Neukum
2003-04-09 10:24     ` Matti Aarnio
2003-04-09 22:07   ` Werner Almesberger
2003-04-09 22:41     ` Frank Davis
2003-04-09 22:55       ` Ulrich Drepper
2003-04-09 23:53         ` Johannes Ruscheinski
2003-04-10  1:43       ` Richard B. Johnson
2003-04-10 18:57         ` Alan Cox
2003-04-10 20:13           ` Trond Myklebust
2003-04-10 19:42             ` Alan Cox
2003-04-11  0:48               ` Christer Weinigel
2003-04-11 15:56                 ` Daniel Stekloff
2003-04-10 20:53             ` Richard B. Johnson
2003-04-10 23:05               ` Jon Portnoy
2003-04-11  5:39                 ` DevilKin
2003-04-11  5:49                   ` Arnaldo Carvalho de Melo
2003-04-11  6:17                     ` DevilKin
2003-04-11 17:51                     ` Randy.Dunlap
2003-04-11 11:57               ` Helge Hafting
2003-04-11 17:55                 ` David Lang
2003-04-10 20:36           ` John Bradford
2003-04-10 22:20             ` Shaya Potter
2003-04-11  4:19               ` Valdis.Kletnieks
2003-04-11  4:23                 ` Shaya Potter
2003-04-11  8:40                   ` Henning P. Schmiedehausen
2003-04-11  9:09                 ` John Bradford
2003-04-11 10:59                   ` Valdis.Kletnieks
2003-04-11 11:11                     ` John Bradford
2003-04-11 11:40                 ` Helge Hafting
2003-04-10  8:19       ` Oliver Neukum
2003-04-09 13:11 ` Giuliano Pochini
2003-04-10  3:08 ` Linus Torvalds
2003-04-10  9:05   ` kernel support for non-English " Riley Williams
2003-04-10 17:35     ` Linus Torvalds
2003-04-10 18:32       ` John Bradford
2003-04-12  2:55       ` Chris Wedgwood

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=PEEPIDHAKMCGHDBJLHKGMEPICGAA.rwhite@casabyte.com \
    --to=rwhite@casabyte.com \
    --cc=Ruth.Ivimey-Cook@ivimey.org \
    --cc=inaky.perez-gonzalez@intel.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).