use UTF-8 in Barrys Scripts (for XDialog AND xmessage)

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

use UTF-8 in Barrys Scripts (for XDialog AND xmessage)

#1 Post by MU »

Look at /usr/sbin/cups_shell

This a a very short script showing the problem.

I have replaced the english strings with variables, that are filled with text in an external .mo file.
This file is saved in leafpad as UTF-8.

The script uses Xdialog and xmessage to display information.
Xdialog displays äöü correct, xmessage does not.
If you save the .mo in Iso format, it is vice versa.

The solution is to install gxmessage, e.g. from
http://dotpups.de/dotpups/System_Utilit ... essage.pup

In Muppy008 it is already included, and "xmessage" was deleted and symlinked to gxmessage.

This is not sufficient though, because gxmessage runs in compatibility-mode with xmessage.

In cups_shell I now added this code in the beginning:

Code: Select all

#--patch for gxmessage with UTF-8 by Mark Ulrich
gx=`which gxmessage`

XMESSAGE="xmessage"
if [ "$gx" != "" ];then
	XMESSAGE="gxmessage -encoding UTF-8"
fi
#-- // end of patch
And you must replace the line that starts with:

Code: Select all

xmessage -bg "medium purple" -title 
with:

Code: Select all

$XMESSAGE -bg "medium purple" -title 
The result:
On a system with gxmessage, now all text is shown correctly.
On a system without gxmessage, the text is shown with wrong UTF-characters in xmessage, but at least it is shown.

Mark

magerlab
Posts: 739
Joined: Sun 08 Jul 2007, 20:08

#2 Post by magerlab »

is it possible to use such a system to translate other scripts in puppy?
i mean to write strings instead of rewriting the scripts themselves( wich of course, can cause many mistakes)

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#3 Post by MU »

Shure, we just did that with the network-wizard:
http://www.murga-linux.com/puppy/viewtopic.php?t=25098

I have explained the basic concept more detailed here:
http://murga-linux.com/puppy/viewtopic.php?t=23345


But both examples are complex.

The Cups-wizard is much simpler, and so easier to understand.
I attach it.
Extract it to a temporary folder.
Then compare it with the original /usr/sbin/cups_shell

Mark
Attachments
Cups-wizard-localized-Puppy301.tar.gz
(2.58 KiB) Downloaded 1154 times

Kazm
Posts: 29
Joined: Mon 14 Jan 2008, 21:53
Location: Russia, Ufa
Contact:

#4 Post by Kazm »

Russian cups-shell.mo file...
Attachments
cups-shell-ru-mo.tar.gz
(1.31 KiB) Downloaded 1110 times

Post Reply