Fatdog64-630rc1 (16 Oct 2013) [CLOSED]

A home for all kinds of Puppy related projects
Message
Author
jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#166 Post by jamesbond »

L18L,

momanager is now in devx. I'll look at the rest. BTW I have one question.

I'm a bit wary of using gettext in scripts (but I realise that this is probably the standard way of doing it - the SSS is very messy because you can't see the strings being used in the program itself), so I'd like to ask you about its impact. Using gettext means that every single instantiation of a string now causes a "fork" to launch gettext.

Depending on the program and how it is being used, this can be almost negligible (if that section of the program is only used once), or it can be very heavy (if the string is used in a loop).

So far, how do you feel of the speed impact?
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Fatdog64-630rc1

#167 Post by L18L »

jamesbond wrote:I'm a bit wary of using gettext in scripts (but I realise that this is probably the standard way of doing it - the SSS is very messy because you can't see the strings being used in the program itself), so I'd like to ask you about its impact. Using gettext means that every single instantiation of a string now causes a "fork" to launch gettext.
I do not get what you mean by "can't see the strings", could you provide an example please?
jamesbond wrote:or it can be very heavy (if the string is used in a loop)
Feel free to define the translated message outside the loop if that is possible.
jamesbond wrote:So far, how do you feel of the speed impact?
I would like to measure it.
(..and LANG=C #because it is faster? ...LC_MESSAGES does slow it down again?)

..or try again using Puppy's official t12s method.....
Translations would not be lost, can be used again...

(updated momanager follows soon...)

mories
Posts: 70
Joined: Mon 21 Dec 2009, 12:51

Question on dual graphics

#168 Post by mories »

With Fatdog64-630rc1 in a system with dual graphics ATI Radeon HD 6470M / Intel HD 3000, how I can use or activate the ATI card with open source module "radeon"?
The kernel modules "radeon" and "i915" are loaded, but Xorg always uses the intel/i965 modules.
Or is this only possible with proprietary modules AMD / ATI?

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#169 Post by jamesbond »

I do not get what you mean by "can't see the strings", could you provide an example please?
I may have been wrong. By the "SSS" method I mean those scripts where i18n is done by putting the strings in variables at the top of the script e.g. MSG1="hello" MSG2="world" and then trying to source "/usr/share/locale/$LANG/msg" which will replace MSG1 & MSG2 with the correct local text. The actual apps don't have embedded strings anymore, they always display using $MSG1 and $MSG2. Is that the SSS method, or is that the t12s method? :)
Feel free to define the translated message outside the loop if that is possible.
Yes, that's what I plan to do - when necessary.
I would like to measure it.
(..and LANG=C #because it is faster? ...LC_MESSAGES does slow it down again?)
LANG=C is definitely faster than any other LANG settings. I tested this early on, even with LANG=en_US or LANG=en_AU it is much slower than LANG=C. LC_MESSAGES doesn't slow it down. It's the $(gettext) that I'm worried about. Anyway, "fast" is relative. As long as the difference is not perceptible, then it is not important.
With Fatdog64-630rc1 in a system with dual graphics ATI Radeon HD 6470M / Intel HD 3000, how I can use or activate the ATI card with open source module "radeon"?
The kernel modules "radeon" and "i915" are loaded, but Xorg always uses the intel/i965 modules.
Or is this only possible with proprietary modules AMD / ATI?
I'm afraid the state of dual graphics is still in a mess. Your best bet is to go with proprietary driver but we don't have that one yet (we usually only release them on *final* release because during testing we change kernels often). In rc2 the kernel will have debugfs and vgaswitcheroo enabled - but please don't get high hopes on this. Vgaswitcheroo worked for earlier models of dual graphics and with intel/nvidia. But with intel/ati the situation is murky. Anyway, none of us have a machine with that combination, so there isn't much we can do (to test, to experiment). My machine is ati/ati dual graphics. When I used Catalyst driver I could choose which card to use. When I'm using radeon open-source, I'm already glad if my screen isn't blank ...
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

#170 Post by L18L »

jamesbond wrote:... those scripts where i18n is done by putting the strings in variables at the top of the script e.g. MSG1="hello" MSG2="world" and then trying to source "/usr/share/locale/$LANG/msg" which will replace MSG1 & MSG2 with the correct local text. The actual apps don't have embedded strings anymore, they always display using $MSG1 and $MSG2. Is that the SSS method, or is that the t12s method?
I would call this a .... (PITA ?)

t12s is named by me developed from technosaurus' (t12s :D ) input...
localizing-shell-scripts-without bashisms, gettext or ...

SSS is Barry's invention and integrated in his momanager.
It is: translate once (using sed), use always after translated once
or in other words: let us look into 1 example
/usr/share/sss/script_strings/script_strings.de

Code: Select all

[general]
#this "script_strings" SSS domain is intended for any scripts that need translation.
#the SSS technique translates files "in place", meaning that the original file gets replaced by the
#translated file (menu_strings domain is slightly different, in that it first generates English files from
#templates, then translates them). Thus the files are translated *before* execution, whereas the gettext
#and t12s methods are run-time translations.
#the translations in this SSS-domain, that is, this file script_strings*, are performed by /usr/sbin/fixscripts, which
#in turn is called from quicksetup (chooselocale) whenever locale is changed, also by rc.update whenever a version upgrade.
#the section-ids are a full path, for example _etc_rc.d_functions4puppy4 means /etc/rc.d/functions4puppy4
# ...i originally imposed this substitution for / as i thought there might be a problem with having / in the section-id
#    however, now i think not. anyway, fixscripts will accept any substitution, ex XetcXrc.dXfunctions4puppy4
#Please type translation only between the last two % characters. 
#Keep all formatting exactly the same, that is retain all " ' < > / \ characters.
# -- do not replace the " and ' with left-side or right-side quote characters.
#Keep all variables as-is, exs: ${DROPOUT} $DROPOUT -- do not translate!

[_etc_rc.d_functions4puppy4]
#target file is /etc/rc.d/functions4puppy4
s%Only very old PCs may have a serial mouse. These are recognised by the fairly large rectangular plug, technically known as a DB9 or the even larger DB25 (where the 9 or 25 refers to the number of pins in the plug). Press the UP and DOWN arrow keys to choose your mouse type, then press the ENTER key:%Nur sehr alte PCs können noch eine serielle Mus haben. Diese erkennt man an dem ziemlich großen eckigen Stecker, technisch bekannt als DB9 oder den sogar größeren DB25 (wobei die 9 oder 25 der Anzahl Pins im Stecker entspricht). Maustyp mit den Pfeiltasten auswählen und dann mit Enter-Taste bestätigen:%
s%(mouse in very old computers)%(Maus in sehr altn Computern)%
s%(mouse or touchpad in all modern computers)%(Maus oder touchpad in allen modernen Computern)%
s%Please choose mouse type...%Bitte Maustyp wählen...%
s%Serial port mouse plugged into...\\nUse UP/DOWN ARROW keys, ENTER key to finish%Serielle Maus angeschlossen...\\nPfeiltasten benutzen und mit Enter-Taste abschließen%
s%(most likely)%(höchstwahrscheinlich)%

[_etc_rc.d_rc.sysinit]
s%"done"%fertig%
s%"failed"%nicht OK%
s%Loading swap partition $ONESWAP...%Lade Swap-Partition $ONESWAP...%
s%Loading swap file ${SWAPFILE}...%Lade Swap-Datei ${SWAPFILE}...%
s%Making the filesystem usable...%Mache das Dateisystem benutzbar...%
s%"Updating..."%Aktualisiere...%
s%Updating unique hostname...%Aktualisiere eindeutigen Hostname...%
s%Loading kernel modules...%Lade Kernel-Module...%
s%Waiting for modules to complete loading...%Warte bis Kernel-Module komplett geladen sind...%
s%Loading user-selected modules...%Lade benutzergewählte Module...%
s%Setting up services (network, printing, etc.)...%Einrichten der Dienste (Netzwerk, Drucken, etc.)...%
s%\[backgrounded\]%\[im Hintergrund\]%
s%Recognising media devices...%Erkennen der Speichermediengeräte...%

[_etc_rc.d_rc.update]
s%" cross-build-fix"%%
s%" network-drivers-list"%Netzwerktreiberliste%
s%" pixbuf-loaders"%%
s%" gtk-icon-cache"%%
s%" desk-icons"%%
s%" $OLDPVERSION to $NEWPVERSION"% $OLDPVERSION auf $NEWPVERSION"%
s%from version $OLDPVERSION to%von Version $OLDPVERSION auf%
s%Upgrading ${DISTRO_NAME} ${VERstr} ${NEWPVERSION}...%%
s%" network-drivers-list"%" Netzwerk-Treiber-Liste"%
s%layered-filesystem%geschichtetes Dateisystem%
s%next boot will be faster!%nächster Neustart wird schneller!%

[_etc_rc.d_rc.country]
s%Select the keyboard layout:\n(UP/DOWN arrows then ENTER key)%Tastaturbelegung auswählen:\n(Pfeiltasten dann Enter-Taste)%
s%Is the hardware clock on the computer set to the local time, or to UTC? Note, most PCs with Windows installed have the hardware clock set to the local time, so if in doubt choose that...%Ist die Hardware-Uhr im Computer auf lokale Zeit gestellt oder auf UTC? Beachte, die meisten PCs mit installiertem Windows haben die Hardware-uhr auf lokale Zeit gestellt, also: im Zweifelsfall das auswählen...%
s%Set hardware-clock type%Typ der Hardware-Uhr%
s%"Local"%"Lokal (Ortszeit)"%
s%"UTC"%"UTC (Universelle Zeit)"%

[_usr_local_petget_0setup]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Fatdog64-630rc1

#171 Post by L18L »

Here is the tool for internationalization of Fatdog.

momanager-20131206.pet uploaded only here because
- pets made by dir2pet in Fatdog cannot be installed in Puppy.
- number of Fatdog users who wish to translate (and can / have a 64 bit system) is unknown

If you want to use it for your language install basic langpack from puppy first.

Feedback appreciated.
Have fun

edit
Viewing the picture I have to add
Next improvement should be:
do not dispay every single script, just 1 for each textdomain is shorter and better
Attachments
create_languagepackFatdog.png
(33.06 KiB) Downloaded 1206 times
momanager-20131206.pet
fit for Fatdog
(26.49 KiB) Downloaded 641 times

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Fatdog64-630

#172 Post by L18L »

example for t12s method of internationalization

/usr/sbin/set-time-for-puppy

Code: Select all

#!/bin/sh
#2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
# A small script used to set the time under Linux with hwclock...
# MU: updated for puppy 1.0.7.
# jamesbond 2012 - add gtksu & other fixes
#131112 L18L internationalisation
#131208 t12s version

#export TEXTDOMAIN=fatdog
export OUTPUT_CHARSET=UTF-8
#. gettext.sh #131208
[ "$LC_MESSAGES" ] && LANG=$LC_MESSAGES # for --calendar and --timebox

app=`basename $0`
T=/usr/share/locales # TEXTDOMAINDIR
# a one-liner to find existing translation file LOCALES allowing 'dialects'
[ ! -f ${T}/${LANG%.*}/${app} ] && LOCALES=${T}/${LANG%_*}/${app} || LOCALES=${T}/${LANG%.*}/${app}
[ -f $LOCALES ] && . $LOCALES # (re)load translation file (when using variables)


# Title to be used for all Xdialog boxes.

#APPTITLE="$(gettext 'Set System Time')"
APPTITLE="${_M_1:-Set System Time}"
set
HWCLOCKPARM="--localtime" # default
HWCLOCKCONF=/etc/hwclock.conf
[ -e $HWCLOCKCONF ] && . $HWCLOCKCONF

[ $(id -u) -ne 0 ] && exec gtksu "$APPTITLE" "$0" 

# Get the date (returned in DD/MM/YYYY format by Xdialog)
#! NEWDATE=`Xdialog --stdout --title "$APPTITLE" --calendar "$(gettext 'Please set the date...')" 0 0 0 0 0` && exit
! NEWDATE=`Xdialog --stdout --title "$APPTITLE" --calendar "${_M_2:-Please set the date...}" 0 0 0 0 0` && exit

# Get the time in HH:MM:SS format.
#if ! NEWTIME=`Xdialog --stdout --title "$APPTITLE" --timebox "$(gettext 'Please set the time...')" 0 0`; then
if ! NEWTIME=`Xdialog --stdout --title "$APPTITLE" --timebox "${_M_3:-Please set the date...}" 0 0`; then
#   Xdialog --title "$APPTITLE" --msgbox "$(gettext 'Aborted.')" 0 0
   Xdialog --title "$APPTITLE" --msgbox "${_M_4:-Aborted.}" 0 0
   exit
fi

# Set system time, then use system time to set the hardware clock (RTC)
OIFS=$IFS; IFS=/; set -- $NEWDATE
D=$1 M=$2 Y=$3

IFS=:; set -- $NEWTIME; IFS=$OIFS
H=$1$2
DT=$M$D$H$Y

date $DT
#Xdialog --title "$(gettext 'info')" --msgbox "$(gettext 'Your screen might turn black now for some seconds, just wait...')" 0 0
Xdialog --title "${_M_5:-info}" --msgbox "${_M_6:-Your screen might turn black now for some seconds, just wait...}" 0 0

hwclock --systohc $HWCLOCKPARM
THEDATE=`date`
#Xdialog --title "$(gettext 'info')" --msgbox "$(eval_gettext 'Finished. Time was set to $THEDATE')" 0 0

[ -f $LOCALES ] && . $LOCALES # (re)load translation file (when using variables)
Xdialog --title "${_M_5:-info}" --msgbox "${_M_7:-Finished. Time was set to $THEDATE}" 0 0

German translation in file /usr/share/locales/de/set-time-for-puppy:

Code: Select all

_M_1="Datum und Uhrzeit"
_M_2="Bitte Datum einstellen..."
_M_3="Bitte Uhrzeit einstellen..."
_M_4="Abgebrochen."
_M_5="Info"
_M_6="Der Bildschirm kann jetzt für ein paar Sekunden schwarz werden, einfach abwarten..."
_M_7="Fertig. Zeit wurde auf $THEDATE gesetzt."
(This example has been "hand made" without yad GUI)

Faster? How much?

--------------------------------------------------

edit
...and translators would be happy if they had a pot file like:

Code: Select all

#set-time-for-puppy.pot

#_M_1
msgid "Set System Time"
msgstr ""

#_M_2
msgid "Please set the date"
msgstr ""

#_M_3
msgid "Please set the time..."
msgstr ""

#_M_4
msgid "Aborted."
msgstr ""

#_M_5
msgid "info"
msgstr ""

#_M_6
msgid "Your screen might turn black now for some seconds, just wait..."
msgstr ""

#_M_7
msgid "Finished. Time was set to $THEDATE"
msgstr ""

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Re: Fatdog64-630

#173 Post by L18L »

L18L wrote:...and translators would be happy if they had a pot file like:
Here is how we will be able to format the messages for t12s:
messages.

Code: Select all

#set-time-for-puppy.po

#_M_1
msgid "Set System Time"
msgstr "Systemzeit einstellen"

#_M_2
msgid "Please set the date"
msgstr "Bitte Datum einstellen..."

#_M_3
msgid "Please set the time..."
msgstr "Bitte Uhrzeit einstellen..."

#_M_4
msgid "Aborted."
msgstr "Abgebrochen."

#_M_5
msgid "info"
msgstr "Info"

#_M_6
msgid "Your screen might turn black now for some seconds, just wait..."
msgstr "Der Bildschirm kann jetzt für ein paar Sekunden schwarz werden, einfach abwarten..."

#_M_7
msgid "Finished. Time was set to $THEDATE"
msgstr "Fertig. Zeit wurde auf $THEDATE gesetzt."
The formatting code

Code: Select all

.#!/bin/sh
# t12s_msgfmt by L18L dec 2013, GPL
#
if [ -z "$1" ]; then echo "usage $0 file.po [> file]"; exit 1; fi
if [ $1 = "-h" -o $1 = "--help" ]; then echo "Convert portable object (po) file.po to translated messages for t12s"; exit 0; fi 
if [ ! -f "$1" ]; then echo "$1 is not a file"; exit 1; fi

echo "#created `date` by $0 for script $1"
while read LINE; do
 case $LINE in
  \#_M_*) ID=${LINE:1} ;;
  msgstr*) echo "${ID}=${LINE#* }" ;;
 esac
done < $1

exit 0
The test run

Code: Select all

# ./t12s_msgfmt set-time-for-puppy.po 
#created Son Dez  8 16:42:09 CET 2013 by ./t12s_msgfmt for script set-time-for-puppy.po
_M_1="Systemzeit einstellen"
_M_2="Bitte Datum einstellen..."
_M_3="Bitte Uhrzeit einstellen..."
_M_4="Abgebrochen."
_M_5="Info"
_M_6="Der Bildschirm kann jetzt für ein paar Sekunden schwarz werden, einfach abwarten..."
_M_7="Fertig. Zeit wurde auf $THEDATE gesetzt."
# 
# 
And the run

Code: Select all

# ./t12s_msgfmt set-time-for-puppy.po > /usr/share/locale/de/set-time-for-puppy

christhi
Posts: 14
Joined: Wed 21 Feb 2007, 01:11

Problem with kernel-source

#174 Post by christhi »

I gave a try at FatDog64 thinking it would work ok with my old AMD 64 Athlon tower.

I had to go through a lot of butthurt in order to do what's pretty much simple under Puppy 5.5. I had to download the huge Devx SFS, then the kernel-source SFS, that wasn't recognized by Getnvidia even it that was the correct version (3.11.4).

In other non-64 Puppies, did not require all this stuff to be installed for having the Nvidia drivers up and running. Why so complicated? Is it because of the specific kernel images for the AMD 64 hardware?

Perhaps the more stable versions of FatDog don't have these problems.

anyways.... some suggestions would be appreciated. Thanks!

User avatar
Ted Dog
Posts: 3965
Joined: Wed 14 Sep 2005, 02:35
Location: Heart of Texas

#175 Post by Ted Dog »

you are trying a RC1 that was highlighted above as a shortcoming. The release Kernel Version was expected to be bumped so the premade blobs for video drivers was not going to be done. Sorry, it is much easier normally.
I think a rumored 64bit Christmas gift is in the works. James and company do get very quiet before an announcement. Its been quiet almost dead on this thread, So your post got me all excited. .... darn not a early Christmas after all... :x

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Fatdog64-630rc1 (16 Oct 2013)

#176 Post by L18L »

I am working at momanager being able to process t12s method.
Translator will see not much difference from gettext.

Just some bug fixing...

p310don
Posts: 1492
Joined: Tue 19 May 2009, 23:11
Location: Brisbane, Australia

#177 Post by p310don »

Late to the party, but I tried 630 over the weekend. Was great, and bad...

I had to rip a DVD. I had used Saluki to do this task, took a couple of hours. Did the same DVD on the same PC in FD64-630RC1, took two minutes. I thought it was majorly broken, but worked fine.

I decided, this is awesome, time to upgrade to a new pup.

Rebooted machine, created save file. Will not reboot. It went to command prompt, tried xorgwizard, tried to change nvidia drivers, no dice.

Deleted save file, rebooted, worked fine. Created a new save file, with no additions (which I had before), rebooted, and no dice again. This time, I just gets to a screen with a "static" line across the top.

PC is AMD64 Athlon II 3.2Ghz, 8gig ram, Nvidia GT-210 booting manual frugal install.

What am I doing wrong?

BTW, I thought it was me, so I did the same install with 620, and it worked fine, with and without a save file.

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#178 Post by nooby »

p310don wrote:Late to the party, but I tried 630 over the weekend. Was great, and bad...

I had to rip a DVD. I had used Saluki to do this task, took a couple of hours. Did the same DVD on the same PC in FD64-630RC1, took two minutes. I thought it was majorly broken, but worked fine.

I decided, this is awesome, time to upgrade to a new pup.

Rebooted machine, created save file. Will not reboot. It went to command prompt, tried xorgwizard, tried to change nvidia drivers, no dice.

Deleted save file, rebooted, worked fine. Created a new save file, with no additions (which I had before), rebooted, and no dice again. This time, I just gets to a screen with a "static" line across the top.

PC is AMD64 Athlon II 3.2Ghz, 8gig ram, Nvidia GT-210 booting manual frugal install.

What am I doing wrong?

BTW, I thought it was me, so I did the same install with 620, and it worked fine, with and without a save file.
As I remember one have to follow their instructions and
not do the save file like one are used to. First time one should
boot with noRAM somethign. Read their FAQ I am too lazy
Edit I thought first I was in a slacko thread and I created a save file
in that distro. Sorry for my mistake.
I use Google Search on Puppy Forum
not an ideal solution though

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#179 Post by jamesbond »

Ted Dog wrote:I think a rumored 64bit Christmas gift is in the works. James and company do get very quiet before an announcement. Its been quiet almost dead on this thread, So your post got me all excited. .... darn not a early Christmas after all... :x
:lol: The reason why kirk and I have been quiet is because both of us are out of town at the moment with intermittent or slow internet access :D and not much time left for Fatdog until we're back home.

p310don, if you open the Fatdog ISO file, you will find isolinux.cfg which contains many workarounds. You may try the ones relevant for nvidia. I think I've already included nouveau.noaccel=1 by default, if not, try that on the kernel parameter and see it improves the situation. If it doesn't work, then let's wait for rc2 - perhaps the newer kernel/nouveau driver has that issue fixed.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

p310don
Posts: 1492
Joined: Tue 19 May 2009, 23:11
Location: Brisbane, Australia

#180 Post by p310don »

Well played JB.

Putting

Code: Select all

nouveau.noaccel=1
at the end of the kernel line in menu.lst for grub4dos worked for me.

Thanks

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Fatdog64-630rc1 (16 Oct 2013) internationalization

#181 Post by L18L »

bug fix for package-manager:

/usr/sbin/fatdog-package-manager.sh (mark was nor working in installed packages)

/usr/sbin/fatdog-package-manager.sh.xml (some translatable=yes added)

QuickApps internationalized using "puppy's official method" t12s
translated using very latest momanager.

BTW, these 2 are my favorite Fatdog apps :D

QuickApps internationalized using t12s method

Code: Select all

#!/bin/sh
# Quick Apps - create shortcut to often used applications
# Copyright (C) James Budiono 2012
# License: GNU GPL Version 3 or later
#
#131215 Internationalization
#131216 t12s version

export OUTPUT_CHARSET=UTF-8
[ "$LC_MESSAGES" ] && LANG=$LC_MESSAGES # for --calendar and --timebox
export TEXTDOMAIN=fd-control-panel

T=/usr/share/locales # TEXTDOMAINDIR
# a one-liner to find existing translation file LOCALES allowing 'dialects'
[ ! -f ${T}/${LANG%.*}/${TEXTDOMAIN} ] && LOCALES=${T}/${LANG%_*}/${TEXTDOMAIN} || LOCALES=${T}/${LANG%.*}/${TEXTDOMAIN}

[ -f $LOCALES ] && . $LOCALES # (re)load translation file (when using variables)


### configuration
APPTITLE="${_M_15:-QuickApps}"
APPICON=/usr/share/midi-icons/go48.png	# temporary icon
QUICKAPPS_HOME=$HOME/QuickApps
DESKTOP_FILES_DIR=/usr/share/applications
REBUILD_LINK="0-${_M_17:-Finish-Configuration}"
INDEX_FILE=.apps

##################### helper #####################

create_quickapps() {
	# if already exist, do nothing
	[ -d "$QUICKAPPS_HOME" ] && return
	
	# otherwise, create it
	mkdir -p "$QUICKAPPS_HOME"
	ln -sfT $(readlink -f "$0") "$QUICKAPPS_HOME/AppRun"
	ln -sfT $(readlink -f "$0") "$QUICKAPPS_HOME/$REBUILD_LINK"
	
	# create AppInfo.xml
	cat > "$QUICKAPPS_HOME/AppInfo.xml" <<EOF
<?xml version="1.0"?>
<AppInfo>
  <Summary>$APPTITLE</Summary>
  <About>
    <Purpose>${_M_19:-Application Launcher - create shortcuts for often-used applications}</Purpose>
    <Version>1.0</Version>
    <Authors>James Budiono</Authors>
    <License>GNU General Public License Version 3 or Later</License>
  </About>
  <AppMenu>
    <Item option="configure" icon="gtk-preferences">
      <Label>${_M_20:-Add/remove application shortcuts}</Label>
    </Item>
  </AppMenu>
</AppInfo>		
EOF
	ln -sfT "$APPICON" "$QUICKAPPS_HOME/.DirIcon"
}

launch_app() {
	fatdog-control-panel.sh "$APPTITLE" "$QUICKAPPS_HOME/$INDEX_FILE"
}

configure_app() {
	rox -d "$QUICKAPPS_HOME"
	rox -d "$DESKTOP_FILES_DIR"
	Xdialog --title "$APPTITLE" --left --infobox "
${_M_13:-Two folders have been opened. One is the QuickApps folder, the other one is the "All applications folder".} 
${_M_12:-You can identify them by looking at the window title. To add a shortcut, follow these three easy steps:}

1. ${_M_18:-Create a new folder in the QuickApps folder.} 
   `gettext "This new folder serves as 'Category' and will appear as a tab in the QuickApps."`
   
2. ${:M_:-From the 'All applications folder', select then drag and drop the applications you want 
   into the 'Category' folder you created in step 1. Choose 'Link' when asked.}
   
3. ${_M_21:-Repeat step 1 and 2 as necessary. When done, click $REBUILD_LINK on the QuickApps folder.} 

${_M_11:-Your QuickApps is available from your HOME folder.}
" 0 0 90000
}

###_:-Repeat step 1 and 2 as necessary. When done, click ${REBUILD_LINK} on the QuickApps folder.} 
### TODO avoid failure from ${} inside $ { _ M _ * }

rebuild_app() {
	rox -D "$QUICKAPPS_HOME"
	rox -D "$DESKTOP_FILES_DIR"
	cd "$QUICKAPPS_HOME"
	rm $INDEX_FILE 2> /dev/null
	tab_count=0
	find . -maxdepth 1 -type d | sed '1 d; s_\./__' | while read p; do
		tab_count=$((tab_count + 1))
		{ 
			echo -n TAB$tab_count=\'$p\| 
			ls "$p" | sed 's/.desktop$//' | tr '\n' ' '
			echo \' 
		} >> $INDEX_FILE
	done
}

############# main ##############
# check how we're launched - directly or as rox app?
case $0 in 
	*AppRun) # as rox app
		case $1 in
			"") 		launch_app ;;
			configure)	configure_app ;;
		esac ;;
	
	*$REBUILD_LINK) # to finish configuration
		rebuild_app ;;	# as "
		
	*)	# as standalone app - do configure
		create_quickapps; exec "$QUICKAPPS_HOME/AppRun" configure ;; 
esac

Momanager has 2 "hello world" samples , one for gettext and one for t12s to play with....
Attachments
momanager.png
(39.24 KiB) Downloaded 1493 times
fatdog-package-manager.sh.xml.gz
save to /usr/sbin/fatdog-package-manager.sh.xml
(43.99 KiB) Downloaded 835 times
fatdog-package-manager.sh.gz
save to /usr/sbin/fatdog-package-manager.sh
(31.62 KiB) Downloaded 656 times

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#182 Post by jamesbond »

L18L,

Thanks for all these. I'm looking at your changes and I have a few questions.
1. For package-manager - where can I find this "gettext.sh"?
2. For t12s quick-apps, how would translation be handled if in the future the application is modified (e.g. deletion of existing strings, addition of new strings (how do these ${M_xxx} gets generated), changes of existing strings)? Can mo-manager automatically re-create all these changes? I surely hope I don't have to look at them one by one?

cheers!
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Fatdog64-630rc1 (16 Oct 2013) internationalization

#183 Post by L18L »

jamesbond wrote:1. For package-manager - where can I find this "gettext.sh"?
locate found it here:

Code: Select all

# locate gettext.sh | grep pup_ro
/aufs/pup_ro10/usr/bin/gettext.sh
#
BTW, I had appended

Code: Select all

# update database for locate
updatedb &
to /etc/rc.d/rc.local
but it did not work, my 1st try was:

Code: Select all

# locate gettext.sh
locate: warning: database `/var/state/locatedb' is more than 8 days old (actual age is 21,6 days)
/aufs/devsave/bootupi18n/puppyrcd_i18n/usr/bin/gettext.sh
/aufs/devsave/dotpup_i18n/usr/bin/gettext.sh
/aufs/pup_ro10/usr/bin/gettext.sh
/usr/bin/gettext.sh
#
Should I better use $HOME/Startup for this?
Last edited by L18L on Sat 21 Dec 2013, 09:34, edited 1 time in total.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

Fatdog64-630rc1 (16 Oct 2013) internationalization

#184 Post by L18L »

jamesbond wrote:2. For t12s quick-apps, how would translation be handled if in the future the application is modified (e.g. deletion of existing strings, addition of new strings (how do these ${M_xxx} gets generated), changes of existing strings)? Can mo-manager automatically re-create all these changes? I surely hope I don't have to look at them one by one?
The tricky part is t12s_xgettext which does that what xgettext does:
create a portable object template file for TEXTDOMAIN At least it tries to do so....
Some rules:
1- In one line of script only one ${_M_}
2- No {} inside ${_M_:-No curly bracket here}
3- No line breaks in ${_M_}, use very long lines, activate Document>Line Wrapping in geany
4 - reload translation file before any ${_M_n:-A $variable inside message}

Adding new message: use just: ${_M_:-new message}
t12s_xgettext will insert the ID number which can be
- an existing one if the message already exists in the TEXTDOMAIN
- or otherwise a new one (last highest number + 1)

Deleting a message: it will not appear in actual TEXDOMAIN.pot

Changing a message: Don't do it. Just remove the ID and change th text, e.g.:

Code: Select all

#MESSAGE="${_M_4711:-Fatdog is just a fat dog}"
MESSAGE="${_M_:-Fatdog is my favorite operating system}"
Then the existing translation
(TEXTDOMAIN.po created by t12s_msgunfmt from translation file /usr/share/locales/<language>/TEXTDOMAIN)
is merged with the actual TEXTDOMAIN.pot by gettext tool msgmerge --no-fuzzy.

The translator will see
- the deleted message commented
- and the translation for new message - msgstr - empty
... almost no difference to working with gettext

Cheers!

I am going to change some of the other scripts to t12s method (using a shell script) maybe just for fun ...

jamesbond
Posts: 3433
Joined: Mon 26 Feb 2007, 05:02
Location: The Blue Marble

#185 Post by jamesbond »

L18L wrote:
jamesbond wrote:
1. For package-manager - where can I find this "gettext.sh"?
locate found it here:
Code:
# locate gettext.sh | grep pup_ro
/aufs/pup_ro10/usr/bin/gettext.sh
#

Ah, yes, of course I was being stupid - I didn't check devx. Thanks! This will have to be moved from devx to the base sfs then.

Quote:
BTW, I had appended
Code:
# update database for locate
updatedb &
to /etc/rc.d/rc.local
but it did not work, my 1st try was:
Code:
# locate gettext.sh
locate: warning: database `/var/state/locatedb' is more than 8 days old (actual age is 21,6 days)
/aufs/devsave/bootupi18n/puppyrcd_i18n/usr/bin/gettext.sh
/aufs/devsave/dotpup_i18n/usr/bin/gettext.sh
/aufs/pup_ro10/usr/bin/gettext.sh
/usr/bin/gettext.sh
#
Should I better use $HOME/Startup for this?

Someone commented in earlier post that you need to create /var/state before running updatedb.

L18L wrote:
jamesbond wrote:
2. For t12s quick-apps, how would translation be handled if in the future the application is modified (e.g. deletion of existing strings, addition of new strings (how do these ${M_xxx} gets generated), changes of existing strings)? Can mo-manager automatically re-create all these changes? I surely hope I don't have to look at them one by one?

The tricky part is t12s_xgettext which does that what xgettext does:
create a portable object template file for TEXTDOMAIN At least it tries to do so....
Some rules:
1- In one line of script only one ${_M_}
2- No {} inside ${_M_:-No curly bracket here}
3- No line breaks in ${_M_}, use very long lines, activate Document>Line Wrapping in geany
4 - reload translation file before any ${_M_n:-A $variable inside message}

Adding new message: use just: ${_M_:-new message}
t12s_xgettext will insert the ID number which can be
- an existing one if the message already exists in the TEXTDOMAIN
- or otherwise a new one (last highest number + 1)

Deleting a message: it will not appear in actual TEXDOMAIN.pot

Changing a message: Don't do it. Just remove the ID and change th text, e.g.:
Code:
#MESSAGE="${_M_4711:-Fatdog is just a fat dog}"
MESSAGE="${_M_:-Fatdog is my favorite operating system}"


Then the existing translation
(TEXTDOMAIN.po created by t12s_msgunfmt from translation file /usr/share/locales/<language>/TEXTDOMAIN)
is merged with the actual TEXTDOMAIN.pot by gettext tool msgmerge --no-fuzzy.

The translator will see
- the deleted message commented
- and the translation for new message - msgstr - empty
... almost no difference to working with gettext

This sounds good. Where does these t12s tools are, I suppose they are not part of momanager? I can put them into devx if you like.
I have one more question - the POT file created by t12s, is it compatible with POT file created by the real msgformat? (I guess not ...)

I have reviewed package-manager's script, I think the gettext method shouldn't have any impact on performance (and if it does, we can always move the slowness outside of a loop). Before you go on commmitting more time on this, which way do you reckon you want to go - gettext of t12s? Speed-wise I think t12s is faster, but gettext is the "standard" method ... I'm slightly leaning towards gettext for two reasons:
- standard
- the gtk-server uses gettext, so if the script is done by t12s that means there are *two* sets of strings to be translated.
Now, I'm not doing the translation so I'm not sure whether the last statement has any impact at all in the translation part. In anyway, I'll go with the method that you choose, but I'd rather we choose one or the other (not both).

EDIT: Package manager localisation is checked in.

EDIT: I wanted to click the quote button but pressed the Edit button and destroyed this original post. Managed to recover it but the formatting is all gone, so be it.

EDIT: Just want to say that I run some unscientific test with localised package manager, it is 2times slower and unlocalised one. Seems to be "bash" slowness - if I unset LC_MESSAGES then everything runs as fast as before (even with eval_gettext left intact)... have to find other ways to optimise it.
Last edited by jamesbond on Sun 22 Dec 2013, 17:50, edited 2 times in total.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]

Post Reply