Bug in EasyJWM for non English language

Moderator: BarryK

Post Reply
Caramel
Posts: 476
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 100 times
Been thanked: 78 times

Bug in EasyJWM for non English language

Post by Caramel »

There is a bug in MenuManager in EasyOS when it is used in a language other than English

When you change the category the entries (in the column "Éléments du menu visibles" in the pîcture) are never displayed:

capture11193.png
capture11193.png (64.56 KiB) Viewed 754 times

Cause of the problem :

In fact, when you choose a category, for example "Système de fichiers" like in the picture, the script /usr/local/easyjwm/menumanager call an internal function "Système de fichiers" that do not exist. The real name of the function is Filesystem (= "Système de fichiers" in French)

Caramel
Posts: 476
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 100 times
Been thanked: 78 times

Re: Bug in EasyJWM for non English language

Post by Caramel »

Possible solution. There may be smarter.

Addition of the sub function execute

Code: Select all

execute() {
	case $1 in
		$(gettext 'Desktop'))
		Desktop
		;;
	
		$(gettext 'System'))
		System
		;;
		
		$(gettext 'Setup'))
		Setup
		;;
		
	
		$(gettext 'Utility'))
		Utility
		;;
		
		$(gettext 'Filesystem'))
		Filesystem
		;;
		
		$(gettext 'Graphic'))
		Graphic
		;;
		
		$(gettext 'Document'))
		Document
		;;
	
		$(gettext 'Business'))
		Business
		;;
	
		$(gettext 'Personal'))
		Personal
		;;
	
		$(gettext 'Network'))
		Network
		;;
		
		$(gettext 'Internet'))
		Internet
		;;
	
		$(gettext 'Multimedia'))
		Multimedia
		;;
	
		$(gettext 'Fun'))
		Fun
		;;
	esac
}
export -f execute

and replacement of

Code: Select all

<action signal="button-release-event">$CATEGORY</action>

by

Code: Select all

<action signal="button-release-event">execute $CATEGORY</action>

EDIT : typo in code fixed

Caramel
Posts: 476
Joined: Sun Oct 02, 2022 6:25 pm
Location: France
Has thanked: 100 times
Been thanked: 78 times

Re: Bug in EasyJWM for non English language

Post by Caramel »

The names of menu items are always in English even if a localization exists.

capture691.png
capture691.png (87.21 KiB) Viewed 719 times

Proposal of modification:

Addition of

Code: Select all

SHORTLANG=`echo $LANG | cut -c 1-2`
TEXT=^Name\\[$SHORTLANG\\]=
export TEXT

Example : If LANG=fr_FR.UTF-8,
SHORTLANG=fr and TEXT=^Name\[fr\]=

In the internal functions, all the lines

Code: Select all

 NAME=$(grep -a -m1 '^Name=' ${DTDIR}/"${FILE}" | cut -d '=' -f2)

(Example: If FILE=alsamixer.desktop, NAME=AlsaMixer audio mixer. This is how Alsamixer is presented in the menu(section Multimedia/Sound) in English

are replaced by

Code: Select all

NAME=$(grep -a -m1 "$TEXT" ${DTDIR}/"${FILE}" | cut -d '=' -f2)
if [[ ! $NAME ]]; then
   NAME=$(grep -a -m1 '^Name=' ${DTDIR}/"${FILE}" | cut -d '=' -f2)
fi
 

If the Name in the localised language exists, it's this name that will be use.
(Example: If FILE=alsamixer.desktop, NAME=Mixeur audio : AlsaMixer)

capture1049.png
capture1049.png (87.51 KiB) Viewed 719 times

EDIT: fix of a copy/paste error in a line of code

User avatar
BarryK
Posts: 2703
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 739 times

Re: Bug in EasyJWM for non English language

Post by BarryK »

Caramel,
Thanks for reporting this problem, and the suggested fixes.

Based on your ideas, I have implemented fixes in the script. Here is the github commit to /usr/local/easyjwm/menumanager:

https://github.com/bkauler/woofq/commit ... 14f6eae61e

@radky
EasyJWM is based upon part of JWMDesk created by radky.
Roger, you might be interested in the non-English fixes in that script.

User avatar
BarryK
Posts: 2703
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 132 times
Been thanked: 739 times

Re: Bug in EasyJWM for non English language

Post by BarryK »

@radky @Caramel
I have just realized, one of those French categories has space characters.

So I think line 211 in menumanager script should be changed from

Code: Select all

"${1}" to "${@}"

Code: Select all

 enCAT=`grep -F "|${@}|" /tmp/easyjwm/mm-categories | cut -f 3 -d '|'`
Post Reply

Return to “EasyOS”