Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 23 Oct 2014, 05:10
All times are UTC - 4
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Internationalization of Fatdog64
Moderators: Lobster, MU, raffy
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 4 [48 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Author Message
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Mon 20 Jan 2014, 12:17    Post subject: Re: Internationalization of Fatdog
Subject description: awk issue
 

jamesbond wrote:
Quote:
But I do not see any difference in GUI output. Rolling Eyes
You're not supposed to see any difference. Only shorter delays. Which isn't happening too Crying or Very sad


I mean the difference between
- using fatdog-package-manager-library.awk (using which or hardcoded) that is slow (15sec)
- using "" that is fast (5 sec)
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: Mon 20 Jan 2014, 13:08    Post subject: Re: Internationalization of Fatdog
Subject description: awk issue
 

L18L wrote:
I mean the difference between
- using fatdog-package-manager-library.awk (using which or hardcoded) that is slow (15sec)
- using "" that is fast (5 sec)

No, that can't be. If AWK_LIB is blank then you will get an error and will see the visual differences immediately - your package list will be totally empty (only the categories). The only explanation is that somehow you're still accessing the old package manager, not the new one then.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Mon 20 Jan 2014, 13:55    Post subject: Re: Internationalization of Fatdog
Subject description: awk issue solved
 

jamesbond wrote:
If AWK_LIB is blank then you will get an error and will see the visual differences immediately - your package list will be totally empty (only the categories).
Now I do see them. You are right. Embarassed
Back to top
View user's profile Send private message 
icake

Joined: 26 Jul 2012
Posts: 175

PostPosted: Tue 21 Jan 2014, 10:48    Post subject: Internationalization of Fatdog
Subject description: UTF-8 characters in Start Menu
 

jamesbond wrote:
Quote:
I think the filename can't be changed (it's mainmenu.svg) but what you can change is the "theme". The default theme is "ambiance", you can copy the entire directory (in /usr/share/razor/themes), change the theme name (e.g. ambience-de), and tell razor-panel to use that theme in /etc/xdg/razor/razor.conf. Disclaimer: haven't tried it myself Cool

This is a much better and more realistic fix than my suggestion. Thanks jamesbond.
kirk wrote:
Quote:
I've attached a pet with the razorqt-panel localization files. I just happened to still have that around. Hope that helps.

Thanks kirk.
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Thu 23 Jan 2014, 06:53    Post subject: Re: Internationalization of Fatdog
Subject description: index, home and faq
 

L18L wrote:
L18L wrote:
Some notes, howto create these translations will follow.
Or just a shell script (store it where ever you like or just paste it to terminal):
Code:
#!/bin/sh
# create translation files for fatdog's home and faqs
...
...
  create_file $f ${L}/$f
done # break endless loop by pressing Ctrl-C

cd - > /dev/null
You might
- translate line 30 (Translated from the <a href="$from">English Original</a>) to your language....
- change style
EDIT
- override an already translated file Crying or Very sad

Here is the improved script for the same purpose.
Code:
#!/bin/sh
TITLE="Translate Fatdog's home and FAQs"
# /usr/share/doc/home/htm must be translated first
# /usr/share/doc/faqs/faq.html must be translated secondly
# choose from faqs directory which one to translate
#140123 avoid overriding, avoid no charset, adjust link in translated faq.html,

function init_vars() {
  L=${LANG%_*} # Chinese and Portuguese might change this line

  for i in /usr/share/doc/help /usr/share/doc/faqs; do mkdir -p $i/$L; done

  TRANSLATED_FROM="Übersetzt aus dem" # Translate this to your language
  ENGLISH_ORIGINAL="Englischen Original" # Translate this to your language

  DEFAULTHTMLEDITOR="seamonkey -edit"
  DEFAULTHTMLEDITOR=geany # for experts
  #DEFAULTHTMLEDITOR=yudit # for 'right-to-left'-languages
}

function go() { echo "
  $1
  Press ENTER to continue or Ctrl_C to cancel"; read x; }

function choose_file() {
  tmp=/tmp/translate_faq$$   
  ALL_FILES=/tmp/translate_faq
  TODO=
  n=0
  ls *.htm* | tr ' ' '\n' > $ALL_FILES
  while read LINE;do
    [ `ls $L | grep $LINE` ] || { n=$(($n + 1)); TODO="$TODO $LINE $n"; }
  done < $ALL_FILES
  case $n in
    0) MSG="No file found, all translations appear to be done." ;;
    1) MSG="This is the last file to translate." ;;
    *) MSG="Choose ONE of these $n files to translate NOW." ;;
  esac
  dialog --title "$TITLE" --menu "$MSG" 0 0 12 `echo $TODO` 2> $tmp
  file_chosen=`cat $tmp`
  rm $tmp $ALL_FILES
}

function create_file() {
  from=$1
  to=$2

  go "Convert $from to $to --to-code=UTF-8"
  iconv --from-code=ASCII --to-code=UTF-8 $from --output=$to

  go "Insert language and change charset to UTF-8"
  sed -i "s/<html>/<html lang=\"$L\">/" $to
  sed -i 's/charset=ISO-8859-1/charset=UTF-8/' $to
  sed -i 's/charset=windows-1252/charset=UTF-8/' $to
  grep 'meta http-equiv="content-type"' $to >/dev/null || sed -i 's#<head>#<head><meta http-equiv="content-type" content="text/html; charset=utf-8">#' $to

  go "Set base for all links"
  sed -i "s#<head>#<head>${BASE}#" $to

  go "Some style"
  sed -i 's@</head>@<style type="text/css">#container {max-width:44em;margin:auto;} h1 img {height:100px;margin:0 2em -.1em 0;} h1 {text-align:center;}   .translated {text-align:right;font-size:67%;}</style></head>@' $to

  go "Set link back to original"
  #sed -i "s#</body>#<p class="translated">Translated from the <a href="$from">English Original</a></p></body>#" $to
  sed -i "s#</body>#<p class="translated">${TRANSLATED_FROM} <a href="$from">${ENGLISH_ORIGINAL}</a></p></body>#" $to

  case  ${to} in
   *${L}/faq.html) : ;;
   *${L}/*.htm*)
    go "Set link to this page in 'index' page faq.html from ${to#*/} to $to
    Don't forget to also translate the link title in ${L}/faq.html"
    sed -i "s@${to#*/}@$to@" ${L}/faq.html ;;
  esac 

  go "That's all I could do for you.

 Note, properties of this file is yet shown as ASCII, when you have entered the first non-ASCII word then it will be shown as UTF-8.

 The file $to will be opened in $DEFAULTHTMLEDITOR now
 Happy translating"
 $DEFAULTHTMLEDITOR $to
}
# /functions

init_vars

for i in /usr/share/doc/help/$L/home.htm /usr/share/doc/faqs/$L/faq.html; do
 [ -f $i ] && continue
 case $i in
   *home*) f=/usr/share/doc/home.htm; BASE='<base href="../../">' ;;
   *faq*)  f=/usr/share/doc/faqs/faq.html BASE='<base href="../">';;
 esac
 create_file $f $i
done  # home.htm and faqs/faq.html translated

cd /usr/share/doc/faqs
while true; do # translate one or some or all faq
  choose_file
  BASE='<base href="../">'
  [ "$file_chosen" ] && create_file $file_chosen ${L}/$file_chosen || break
done # break endless loop by cancel in dialog
cd - > /dev/null

[ $n -gt 0 ] && echo "See you later, use just
$0
in Terminal." || echo bye, hope you really did translate something.
#

Happy translating
translate_home_and_faq.png
 Description   
 Filesize   11.86 KB
 Viewed   404 Time(s)

translate_home_and_faq.png


Last edited by L18L on Thu 23 Jan 2014, 14:30; edited 1 time in total
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Thu 23 Jan 2014, 14:18    Post subject: choose-locale  

jamesbond wrote:
I will look into choose-locale later ...

Code:
               # read the source for title (description), language, and territory (country)
               while read -r q ; do
               case $q in
#                     title*|language*) echo -n "\"${q#*\"}|" ;;
#                     territory*) echo "\"${q#*\"}"; break ;;
                     title*)     TI="\"${q#*\"}" ;;
                     language*)  LA="${q#*\"}" ;;
                     territory*) TE="\"${q#*\"}" ;;
                      lang_name*) lang_name="\"${q#*\"}"
                              lang_name="${lang_name%?}"
                                  lang_name="${lang_name//>/}"
                                 lang_name="${lang_name//</\\}"
                                 LN=`printf \"$lang_name\"`
                              echo "${TI}|${LN} ${LA}|${TE}"; break ;;
                  esac
               done < $LOCALE_DEF_DIR/$src

Above code reads lang_name from files in in /usr/share/i18n/locales and does produce something.
..and messes up some other thing (->ISO-8859-8 and UTF-8 and ...)

(Xdialog:5169): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

15 sec vs 1 or 2 sec
lang_name_from_glibc-locale.png
 Description   
 Filesize   21.06 KB
 Viewed   297 Time(s)

lang_name_from_glibc-locale.png

Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: Thu 23 Jan 2014, 21:16    Post subject: Re: choose-locale  

Quote:
(Xdialog:5169): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()
Bash's unicode support for "printf" seems to be broken. Fatdog's /usr/bin/printf links to busybox and isn't unicode aware, so it doesn't help either. This one does.it.

L18L wrote:
Above code reads lang_name from files in in /usr/share/i18n/locales and does produce something.
..and messes up some other thing (->ISO-8859-8 and UTF-8 and ...)

This will work, assuming you have compiled show-ucs-data linked above.
Code:

            # only process if we have the source file
            if [ -e $LOCALE_DEF_DIR/$src ]; then
               # locale and charmaps
               echo -n "${p%%/*}|${p##*/}|"
               
               # read the source for title (description), language, and territory (country)
               LN='"'
               while read -r q ; do
               case $q in
                     %*) ;; # comment, ignore
#                     title*|language*) echo -n "\"${q#*\"}|" ;;
#                     territory*) echo "\"${q#*\"}"; break ;;
                     title*)     TI="\"${q#*\"}" ;;
                     language*)  LA="${q#*\"}" ;;
                     territory*) TE="\"${q#*\"}" ;;
                     lang_name*) LN="\"${q#*\"}"; LN="${LN%\"*} " ;;
                  esac
               done << EOF
$(./show-ucs-data $LOCALE_DEF_DIR/$src)
EOF
               echo "${TI}|${LN}${LA}|${TE}"
            fi



Quote:
15 sec vs 1 or 2 sec

That's because now it has to scan every line in locale files instead of scanning just a few lines at the top.

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Fri 24 Jan 2014, 08:57    Post subject: Re: choose-locale  

jamesbond wrote:
This will work, assuming you have compiled show-ucs-data linked above.
Code:

            # only process if we have the source file
            if [ -e $LOCALE_DEF_DIR/$src ]; then
               # locale and charmaps
               echo -n "${p%%/*}|${p##*/}|"
               
               # read the source for title (description), language, and territory (country)
               LN='"'
               while read -r q ; do
               case $q in
                     %*) ;; # comment, ignore
#                     title*|language*) echo -n "\"${q#*\"}|" ;;
#                     territory*) echo "\"${q#*\"}"; break ;;
                     title*)     TI="\"${q#*\"}" ;;
                     language*)  LA="${q#*\"}" ;;
                     territory*) TE="\"${q#*\"}" ;;
                     lang_name*) LN="\"${q#*\"}"; LN="${LN%\"*} " ;;
                  esac
               done << EOF
$(./show-ucs-data $LOCALE_DEF_DIR/$src)
EOF
               echo "${TI}|${LN}${LA}|${TE}"
            fi

Thanks for the code.
Yes it works, but not the way we need it.

Reason: lang_name is not always in locales
see: English, English English and English
I have manually inserted lang_name into de_AT. (deutsch of Austria)

I have changed SUPPORTED to contain UTF-8 only
Code:
grep UTF-8 SUPPORTED.orig > SUPPORTED
for the screenshot.

EDIT
Code:
# time show-ucs-data /usr/share/i18n/locales/de_DE | grep lang_name
lang_name     "Deutsch"

real   0m0.015s
user   0m0.010s
sys   0m0.000s
# show-ucs-data /usr/share/i18n/locales/de_LU | grep lang_name
#
lang_name_from_glibc-locale_is_optional .png
 Description   
 Filesize   13.22 KB
 Viewed   302 Time(s)

lang_name_from_glibc-locale_is_optional .png

Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Fri 24 Jan 2014, 12:34    Post subject: Re: choose-locale  

L18L wrote:
Thanks for the code.
Yes it works, but not the way we need it.

Reason: lang_name is not always in locales
see: English, English English and English
I have manually inserted lang_name into de_AT. (deutsch of Austria)


...and inserted all missing (available Question ) lang_names using:
Code:
#!/bin/sh
# insert missing lang_name into /usr/share/i18n/locales files

WORK_DIR=/usr/share/i18n
cd $WORK_DIR/locales >/dev/null

#find locales without lang_name
echo -n '' > ../NO_LANG_NAME
for L in `ls`; do
  [ ${L%%_*} = "iso14651" ] && continue
  [ ${L%%_*} = "translit" ] && continue
  [ ${L%%_*} = "POSIX" ] && continue
  grep ^lang_name $L && { echo "$L
  "; } || echo $L >> ../NO_LANG_NAME
done
   
while read LINE; do
  lang_name=
  #echo -n "LINE=$LINE"
  lang=${LINE%%_*}
  #echo " lang=$lang"
  lang_list=`ls ${lang}_*`
  lang_name="`for i in ${lang_list}; do grep  lang_name $i; done | head -n 1`"
  if [ "$lang_name" ]; then
    #echo insert $lang_name into $LINE
    sed -i  "s/LC_IDENTIFICATION/LC_IDENTIFICATION\n${lang_name}/"   $LINE
  fi
done < ../NO_LANG_NAME

rm ../NO_LANG_NAME
cd - >/dev/null


So we can let it be until the Frisians complain Wink
lang_name_from_glibc-locale_missing_ones_inserted.png
 Description   
 Filesize   13.46 KB
 Viewed   340 Time(s)

lang_name_from_glibc-locale_missing_ones_inserted.png

Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Sat 25 Jan 2014, 11:03    Post subject: Re: choose-locale  

Above GUI needed 15 sec

6 sec only if (I have done it) locales files are converted once ( 1.1 sec )
Code:
#!/bin/sh
# convert all locales /usr/share/i18n/locales files  to ucs

WORK_DIR=/usr/share/i18n
cd $WORK_DIR/locales >/dev/null

mkdir -p ../locales.ucs

for L in `ls`; do
  case 4L in
    iso14651*)       cp $L ../locales.ucs/$L ;;
    translit*)       cp $L ../locales.ucs/$L ;;
    POSIX)           cp $L ../locales.ucs/$L ;;
    *) show-ucs-data $L > ../locales.ucs/$L ;;
  esac
done

cd - >/dev/null
and used
Code:
LOCALE_DEF_DIR=/usr/share/i18n/locales.ucs

Code:
               done < $LOCALE_DEF_DIR/$src
#              done << EOF
#$(show-ucs-data $LOCALE_DEF_DIR/$src)
#EOF



in /usr/sbin/fatdog-choose-locale.sh

...Will test now in a locale without UTF-8....

EDIT: confirm: it works Cool
Back to top
View user's profile Send private message 
jamesbond

Joined: 26 Feb 2007
Posts: 2230
Location: The Blue Marble

PostPosted: Wed 29 Jan 2014, 00:32    Post subject: Re: choose-locale  

L18L wrote:
Above GUI needed 15 sec

6 sec only if (I have done it) locales files are converted once ( 1.1 sec )

In fact, you have a great idea (why don't I think of this myself! Laughing ) Rather than playing with this trick (SUPPORTED is a file from glibc, it will change in 700; same with those locale/* stuff; so I would prefer not to mess with them unless we really have to), we can in fact cache the entire pipeline. Something like this, instead of:
Code:
# --treeview <text> <height> <width> <list height> <tag1> <item1> <status1> <item_depth1> {<help1>}...
if selection=$(eval Xdialog --stdout --title \"$APPTITLE\" \
             --backtitle \"Current locale is \'$LANG\'\" \
             --treeview \"Select your locale\" 30 80 0 $(supported_locales) ); then

We cache the output of supported_locales
Code:

# --treeview <text> <height> <width> <list height> <tag1> <item1> <status1> <item_depth1> {<help1>}...
! [ -e /var/cache/supported_locales ] && supported_locales > /var/cache/supported_locales
if selection=$(eval Xdialog --stdout --title \"$APPTITLE\" \
             --backtitle \"Current locale is \'$LANG\'\" \
             --treeview \"Select your locale\" 30 80 0 $(cat /var/cache/supported_locales) ); then

First time invocation will be a bit slow (that's the original 15s, or if you put in your enhancements, it can be down to 6 secs), but next invocation will be instant Exclamation

_________________
Fatdog64, Slacko and Puppeee user. Puppy user since 2.13.
Contributed Fatdog64 packages thread
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Wed 29 Jan 2014, 10:52    Post subject: Re: choose-locale  

jamesbond wrote:
Rather than playing with this trick (SUPPORTED is a file from glibc, it will change in 700; same with those locale/* stuff; so I would prefer not to mess with them unless we really have to), we can in fact cache the entire pipeline.

...the play went on using unifont.ttf from .http://czyborra.com/unifont/updates/
( download and
move to /usr/share/fonts/default/TTF/
click Update-Fonts
reboot and have fun
)

Code:
                     country_name*) CN="\"${q#*\"}" ; CN="${CN%\"*} " ;;
                  esac           
               done < $LOCALE_DEF_DIR/$src
#              done << EOF
#$(show-ucs-data $LOCALE_DEF_DIR/$src)
#EOF
#               echo "${TI}|${LN}${LA}|${TE}"

               [ "${LA%?} " = "${LN#?}" ] && LA='"' #avoid "Afrikaans Afrikaans"
               [ ${#LN} -gt 1 ] && LA='"'
               echo "${TI}|${LN}${LA}|${CN}${TE}"

            fi
            ;;
      esac
   done < $SUPPORTED_GLIBC_LOCALES | tr -d '"' |
added country_name;
uses lang_name only (not language) if exists


glibc-2,18 has some new locales (ex: suomi) but the old crap is still there.
lang_name_from_glibc-2.18.png
 Description   
 Filesize   12.49 KB
 Viewed   209 Time(s)

lang_name_from_glibc-2.18.png

Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Sun 12 Oct 2014, 14:42    Post subject: Internationalization of Fatdog64-630
Subject description: New thread: Internationalization of Fatdog64-700
 

Cancelled.

Edit
murga is not ready for upload at the moment. Crying or Very sad
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Mon 13 Oct 2014, 08:15    Post subject: Internationalization of Fatdog64-700_b1  

(I have not been able to create a new thread for this
so will continue here)

Install Fatdog64-700b1 (64 bit computer required)

Non-English users (... and translators Laughing ) might download
fd64-nls_700b1.sfs
and load it.

Then use Set locale (Control Panel) to set locale other than English.
fatdog1.png
 Description   
 Filesize   46.74 KB
 Viewed   72 Time(s)

fatdog1.png

Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2525
Location: Moved from Hosla to www.eussenheim.de

PostPosted: Mon 13 Oct 2014, 08:22    Post subject: Internationalization of Fatdog64-700b1
Subject description: fatdog.pot
 

Attached is fatdog.pot

Instructions

no devx required, no momanager at the moment.

change to directory
/usr/share/locale/<lang>/LC_MESSAGES
where <lang> is nl for Nederlands, fr for Francais, ru for Pycckuu,....

download attached file as fatdog.pot to this directory (no .gz in file name)

create portable object file <lang>.po by
Code:
msginit


edit this file (translate some or some more or all ) using geany (or poedit....)

create machine obnject file fatdog.mo for your language
Terminal wrote:
msgfmt <lang>.po -o fatdog.mo


See your translations in action..... correct mistakes.


---
edit
..... and upload your fatdog64.mo here
thus it can be included into the sfs
fatdog.pot.gz
Description 
gz

 Download 
Filename  fatdog.pot.gz 
Filesize  46.71 KB 
Downloaded  6 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 3 of 4 [48 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Puppy Projects » Localization Project
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1543s ][ Queries: 13 (0.0082s) ][ GZIP on ]