using yoshi to set language preferences
I just ported a Java app called GoGrinder, which lets you explore Go (the board game) problems. In the documentation it says

To set GoGrinder to use a specific language, you can run it once using the defaultLanguage option:
java -jar GoGrinder.jar defaultLanguage=fr
GoGrinder will remember this setting in future sessions.
Currently supported languages and codes:
English - en
Czech - cz
German - de
Spanish - es
French - fr
Portuguese - pt
Russian - ru
Chinese - zh

So how do we write this into a little preferences applet? No problem. In the apps directory I created a yoshi file:

*.title = Change GoGrinder UI language
popup.type = popup
popup.label = New language?
popup.option1 = English
popup.option2 = Czech
popup.option3 = German
popup.option4 = Spanish
popup.option5 = French
popup.option6 = Portuguese
popup.option7 = Russian
popup.option8 = Chinese
popup.default = option1

and a bash script


## who am i? ##
_script="$(readlink -f ${BASH_SOURCE[0]})"

## Delete last component from $_script ##
_base="$(dirname $_script)"

cd $_base

if [ ! -f /bin/yoshi ]; then
    alert "This preference applet requires yoshi, available from the Fatelk repo"
    exit 1
    tmpfile=`finddir B_COMMON_TEMP_DIRECTORY`/gogrinderout
    yoshi ./gogrinder.yoshi>$tmpfile
    #we only need the first line for this one so no need for while IFS ...
    read response < $tmpfile
    case $response in
    java -jar GoGrinder.jar defaultLanguage=$lang
    rm $tmpfile

I thought of doing radiobuttons at first but you only get six of those to play with and I needed eight.

One case where this will fall flat is if yoshi is installed in ~/config instead of /boot/system. I'll see if I get around to fixing that - not fond of disjunctions in bash.

So now all I need to do is to stick an icon onto that script and link it to the Preferences section of the Deskbar. Total disk usage just over a kilobyte. I Heart yoshi!


if [ ! -f /bin/yoshi ]; then


if [ ! -f /bin/yoshi ] && [ ! -f ~/config/bin/yoshi ]; then


Forum Jump:

Users browsing this thread: 1 Guest(s)
Free Web Hosting