[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-i18n
Subject:    A tool for updating .kdelnk files
From:       "Bjarni R. Einarsson" <bre () netverjar ! is>
Date:       1998-10-30 12:22:13
[Download RAW message or body]

Hi all,

I have written a simple (read: quick'n'dirty) perl script to update the
translations of .kdelnk and .directory files.

It's available at:

	http://www.mmedia.is/~bre/kde-isl/upd-kdelnks.gz

There is also a sample translation table in the same directory, named 
trans.kdelnks.gz (this will give you Icelandic menus for KDE 1.0).

To use it, create a big-ole text file with two columns (or just edit mine,
it's a pretty complete list for KDE 1.0).  Then just run the program from
the directory you wish to translate, giving it the contents of your
translation table as standard input.

The first column of the translation table should contain the exact text of
some other description in the .kdelnk file.  The second column should
contain your translations.  The columns MUST be separated by tab characters
(spaces are valid parts of your description).

Since some programs have the same text in the Name and Comment fields, and
you may wish to translate the two fields differently, you can prefix each
line of the translation table with "Comment=" or "Name=" to specify which
you are translating.  If neither is specified, the program will translate
both.

The program handles both Comment= and Name= fields, and will remove old
translations.  The script currently has the language to be translated
hard-coded into it, so be sure to edit the $lang and $throwaway variables to
match your locale:

A simple example for German:

	$lang = "de";
	$throwaway = '\[de\]=';

When you run the program, it does the following things:

        1. It reads a list of phrases/translations from stdin.
	2. It uses "find" to search for .kdelnk and .directory files,
	   starting in the current working directory.
	3. Each file is scanned for a Comment= line and/or a Name= line
	   matching a phrase in the list.  If one is found, a translation 
	   for the selected language is added to the file.  Any other
	   translations for that language are discarded.

So to update your current KDE installation, you'd do something like this:

	cd /opt/kde
	tar cvf /tmp/sharebackup.tar share/ 	<- paranoia!
	cd share
	upd-kdelnks < /path/to/translation/table

Note that running it from the share directory will translate your mimelnk
tree as well as the applnk tree.  This is a Good Thing.

To update user's home directories, do something similaur from /home, and to
update the source tree itself, try it in /usr/src/kde/ (or wherever you keep
our sources).

The program hasn't destroyed my .kdelnk files recently, so I feel secure
enough to share this with the rest of you.  But make backups, especially
while you are learning how to create the translation table!

I hope this makes someone's life a little easier! :-)

Feel free to send me bug-reports and enhancements.. but please don't ask me
for help using it, as I'm kinda swamped these days.  Just make backups and
expirament.

-- 
Bjarni R. Einarsson
 bre@netverjar.is -=- http://www.mmedia.is/~bre/ -=- Juggler@IRCnet

* http://www.europarl.eu.int/dg4/stoa/en/publi/166499/execsum.htm *
  Encrypt the covert narcotics, launder nuclear biotechno cash on
  the way to Swiss with your GSM phone - are you paranoid enough?

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic