Localization /usr/share/doc index/home.htm [SOLVED]

For efforts in internationalising Puppy and solving problems in this area
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

Localization /usr/share/doc index/home.htm [SOLVED]

#1 Post by Argolance »

Hello,
These files are in /usr/share/doc:
  • index.html
    index.html.bottom
    index.html.bottom-raw
    index.html.top
    index.html.top-raw

    home.htm
    home-raw.htm
This is very confusing for me :oops:. I would like to know how this is working, I mean, what files have to be translated and what files have not to be?
Thank you for your attention.

Cordialement..
Last edited by Argolance on Thu 02 May 2013, 10:27, edited 1 time in total.

rodin.s
Posts: 344
Joined: Wed 22 Sep 2010, 19:50
Location: Ukraine

#2 Post by rodin.s »

I translated these files with momanager and I guess raw-files are for translation.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#3 Post by Argolance »

Thanks!

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

Re: Translation/localization /usr/share/doc index/home.htm

#4 Post by L18L »

Argolance wrote:...These files are in /usr/share/doc:
  • index.html
    index.html.bottom
    index.html.bottom-raw
    index.html.top
    index.html.top-raw

    home.htm
    home-raw.htm
Would you like to experiment with these?

Put the translated -raw files into
langpack-template/usr/share/doc/help/fr or ..../help/ru

.. and add another 3 files to langpack-template:
langpack-template/usr/sbin/puppyhelp wrote:#!/bin/sh
pman index
This will bring ....help/<language>/index.html
or English if no translation help....
langpack-template/pinstall_hacks.sh wrote:LANG1="`cat pet.specs | cut -d'-' -f1 | cut -d'_' -f2`" #130424
indexgen.sh /usr/share/doc/help/${LANG1} #130430
This generates index and home
langpack-template/usr/sbin/indexgen.sh wrote:#!/bin/bash
#(c) Copyright Barry Kauler 2009, puppylinux.com.
#2009 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
#generates index.html master help page. called from petget, rc.update,
# /usr/local/petget/installpreview.sh, 3builddistro (in Woof).
#w012 commented-out drop-down for all installed pkgs as too big in Ubuntu-Puppy.
#w016 support/find_homepages (in Woof) used to manually update HOMEPAGEDB variable.
#w019 now have /root/.packages/PKGS_HOMEPAGES
#w464 reintroduce dropdown help for all builtin packages.
#v423 file PKGS_HOMEPAGES is now a db of all known pkgs, not just in puppy.
#120225 copy from raw doc files.
#130430 L18L also for additional translations

[ "$1" ] && DIR="$1" || DIR='/usr/share/doc' # or ex: /usr/share/doc/help/de #130430

export LANG=C
. /etc/DISTRO_SPECS #has DISTRO_BINARY_COMPAT, DISTRO_COMPAT_VERSION, DISTRO_PUPPYDATE
. /root/.packages/DISTRO_PKGS_SPECS

WKGDIR="`pwd`"

#120225 this is done in Woof by rootfs-skeleton/pinstall.sh, but do need to do it
#here to support language translations (see /usr/share/sss/doc_strings)...
if [ -f $DIR/index.html.top-raw ];then #see Woof rootfs-skeleton/pinstall.sh, also /usr/share/sss/doc_strings
cp -f $DIR/index.html.top-raw $DIR/index.html.top
cp -f $DIR/index.html.bottom-raw $DIR/index.html.bottom
cp -f $DIR/home-raw.htm $DIR/home.htm

cutDISTRONAME="`echo -n "$DISTRO_NAME" | cut -f 1 -d ' '`"
cPATTERN="s/cutDISTRONAME/${cutDISTRONAME}/g"
RIGHTVER="$DISTRO_VERSION"
dPATTERN="s/PUPPYDATE/${DISTRO_PUPPYDATE}/g"
PATTERN1="s/RIGHTVER/${RIGHTVER}/g"
PATTERN2="s/DISTRO_VERSION/${DISTRO_VERSION}/g"
nPATTERN="s/DISTRO_NAME/${DISTRO_NAME}/g"

sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" -e "$cPATTERN" $DIR/index.html.top
sed -i -e "$PATTERN1" -e "$PATTERN2" -e "$nPATTERN" -e "$dPATTERN" $DIR/index.html.bottom
#...note, /usr/sbin/indexgen.sh puts these together as index.html (normally via rc.update and 3builddistro).

sed -i -e "$nPATTERN" /$DIR/home.htm
fi

#search for installed pkgs with descriptions...

#search .desktop files...
PKGINFO1="`ls -1 /usr/share/applications | sed -e 's%^%/usr/share/applications/%' | xargs cat - | grep '^Name=' | cut -f 2 -d '='`"
#...normal format of each entry is 'name description', ex: 'Geany text editor'.

EXCLLISTsd=" 0rootfs_skeleton autologin bootflash burniso2cd cd/dvd check configure desktop format network pupdvdtool wallpaper pbackup pburn pcdripper pdict pdisk pdvdrsab pmetatagger pschedule pstopwatch prename pprocess pmirror pfind pcdripper pmount puppy pupctorrent pupscan pupx pwireless set text "

cp -f $DIR/index.html.top /tmp/newinfoindex.xml

#dropdown menu for apps in menu...
echo '<p>Applications available in the desktop menu:</p>' >>/tmp/newinfoindex.xml
echo '<center>
<form name="form">
<select name="site" size="1" onchange="javascript:formHandler()">
' >>/tmp/newinfoindex.xml
echo "$PKGINFO1" |
while read ONEINFO
do
NAMEONLY="`echo "$ONEINFO" | cut -f 1 -d ' ' | tr [A-Z] [a-z]`"
EXPATTERN=" $NAMEONLY "
nEXPATTERN="^$NAMEONLY "
[ "`echo "$EXCLLISTsd" | grep -i "$EXPATTERN"`" != "" ] && continue
HOMESITE="http://en.wikipedia.org/wiki/${NAMEONLY}"
REALHOME="`cat /root/.packages/PKGS_HOMEPAGES | grep -i "$nEXPATTERN" | head -n 1 | cut -f 2 -d ' '`"
[ "$REALHOME" != "" ] && HOMESITE="$REALHOME"
echo "<option value="${HOMESITE}">${ONEINFO}" >> /tmp/newinfoindex.xml
done
echo '</select>
</form>
</center>
' >> /tmp/newinfoindex.xml

#w464 dropdown list of all builtin pkgs...
echo '<p>Complete list of packages (in Puppy or not):</p>' >>/tmp/newinfoindex.xml
echo '<center>
<form name="form2">
<select name="site2" size="1" onchange="javascript:formHandler2()">
' >>/tmp/newinfoindex.xml
sed -e 's% %|%' -e 's%$%|%' /root/.packages/PKGS_HOMEPAGES > /tmp/pkgs_homepages_mod
printcols /tmp/pkgs_homepages_mod 2 1 | sed -e 's%^%<option value="%' -e 's%|$%#%' -e 's%|%">%' -e 's%#$%%' >> /tmp/newinfoindex.xml
sync
echo '</select>
</form>
</center>
' >> /tmp/newinfoindex.xml

#now complete the index.html file...
cat $DIR/index.html.bottom >> /tmp/newinfoindex.xml
mv -f /tmp/newinfoindex.xml $DIR/index.html

###END###
just one small change made by me: $DIR

If we use this then our translations (ru, fr and de) of home and index can co-exist in one installation. (and the English files are not overwritten).

[edit] Note,
insert

Code: Select all

<base href="../../" />
after <head> of html
and the images and links are OK

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#5 Post by Argolance »

Hello,
Thank you for answering.
In the /usr/share/doc/langpack-template directory, I just see pinstall.sh which is very similar to your indexgen.sh bu no /pinstall_hacks.sh file!
Sorry if what I say is silly... :oops:

Cordialement.

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#6 Post by Argolance »

PS:
If we use this then our translations (ru, fr and de) of home and index can co-exist in one installation. (and the English files are not overwritten).
This is exactly what I was looking for and the first reason of this topic!

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

Translation/localization /usr/share/doc index/home.htm

#7 Post by L18L »

Argolance wrote:...In the /usr/share/doc/langpack-template directory, I just see pinstall.sh...
That is the default content of /usr/share/doc/langpack-template.

You can add what you like to your langpack-template.
In our case now:
/usr/sbin/puppyhelp
and
/usr/sbin/indexgen.sh
( other things to could add (I have done so):
all README.txt translated and renamed to LIESMICH.txt )

pinstall_hacks.sh is "sourced" if existent (see code in pinstall,sh)

Just try to create a new langpack_fr and see how it is.
( Or post more qestions )

I am glad that "this is exactly what you were looking for" so I am not alone with this :D

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#8 Post by Argolance »

hello L18L,
Thank you so much!
I could adapt the script above to make mine working well! I had to know how all this works and your explanations were very useful!

Cordialement.

Post Reply