urxvt Emacs nroff

man (manual) pages in Swedish

First, here is an example file you may download and muck around with: it is a translated man page. Get (or view) it as text or get it as the real thing, compressed, as it would look as a man database entry (and likewise a file in your filesystem).

Now, we're set. The manpages are located here

/usr/share/man/manX/command.X.gz

where X is a digit from 1 to 8. Those are the sections of the man database.

Sometimes several manpages share a singe keyword or command name. command is the word I used in the search path above; really, it doesn't have to be a command although that is a common case. If two manpages have the same keyword you can specify the section with -s X to get the intended manpage.

For example, try man -s 8 shutdown and man -s 2 shutdown. (If you just type man shutdown, you get section 8. Probably this is simply due to the search order.)

In Emacs, to specify the section

M-x man RET shutdown(8)

If, for translating or whatever reason, you'd like to edit a file, use gunzip on the .gz file. The result file might look like this: shutdown.8 - you may edit it in any editor (although the Emacs nroff mode is helpful). If you use Emacs, you don't need to gunzip the file; just open it as any other and Emacs will put you in nroff mode.

To view the modified result, use man ./shutdown.8 or, again in Emacs, M-x man RET ./shutdown.8 (if you're in the same directory; otherwise type the absolute path instead).

Be sure to note the underlined portions of the commands above: that's the only difference from the common, everyday usage of man, but the practical difference is all the bigger: with the former syntax, you get the man database entry; with the latter, you get whatever is in the parameter file. At that point, man is more or less (!) a pager, not a documentation database.

Also, I should mention that I tried this on a Linux system - namely my Debian - however, as for BSD and Solaris/SunOS, either seem to deal with manpages in a way that is not identical to that of Linux. I'm sure you can make it work; but, as for the above "explicit path" syntax, when I tried it, it didn't work.

To make it work for real, seamlessly with no fuss, locate the manpage file like this:

/usr/share/man/sv/man8/shutdown.8.gz

where the sv subdirectory is for Swedish (ru for Russian, etc.)

Then, simply

man -Lsv shutdown

If you always would like Swedish manpages, in ~/.bashrc, put:

alias man="man -Lsv"

(Of course, if you use zsh and not bash, the file would be ~/.zshrc, and so on for whatever shell you use.)

Using Emacs, in ~/.emacs, put:

(setq Man-switches "-Lsv")

Then use M-x man ... as usual.

You should not be afraid to try this: If there is no Swedish translation available (and this will happen a lot :) you simply get the corresponding page in English instead. So, there is no harm to it.