The time now is Thu 23 May 2013, 08:30
All times are UTC - 4 |
| Author |
Message |
Karl Godt

Joined: 20 Jun 2010 Posts: 2675 Location: Kiel,Germany
|
Posted: Sun 21 Apr 2013, 06:00 Post subject:
script to create all charmaps for all languages |
|
Gambling for to know a little more about charmaps and languages I wanted to create them all into /usr/lib/locale .
Since the default glibc source installs some 200 charmaps I wanted to know which ones would work and which not .
Puppy ships with one or two dozen charmaps by default .
Puppy chooselocale code is a little weird to understand .
So I started some days ago to implement the " -createall " option into chooselocale , but that looks ugly for now .
So just a languages_create_all script :
| Code: |
#!/bin/sh
# Karl Reimer Godt April 2013
trap 'echo -e "\n";exit' INT
WANTED_LANG='';
[ "$1" ] && WANTED_LANG="$1" #ie de
WANTED_LANG="${WANTED_LANG:0:2}"
echo "WANTED_LANG=$WANTED_LANG'"
for language in $(ls -1 /usr/share/i18n/locales | grep -v -E 'i18n|iso|translit|POSIX|C'); do
echo "${language:0:2}"
[ ! "$WANTED_LANG" ] || { [ "${language:0:2}" = "$WANTED_LANG" ] || continue; }
while read char_map ; do
char_map=${char_map%\.*}
echo "${language}.${char_map}"
LOGFILE=$tmpDir/${language}.${char_map}.log
#timeout -t 10 -s HUP
localedef $L_QUIET $L_FORCE $VERB -f $char_map -i $language --no-archive "${language}.${char_map}" > "$LOGFILE" 2>&1;LOCALEDEFR=$?
if [ "$LOCALEDEFR" != 0 ] ; then
echo -e "\\033[1;31mSomething Wrong"
[ -s "$LOGFILE" ] && tail "$LOGFILE" || rm -f "$LOGFILE"
echo -e "\\033[0;39m"
if [ ! "${language//[_[:alpha:]]/}" ] ; then
rmdir /usr/lib/locale/${language}.`echo "${char_map//-/}" | tr '[A-Z]' '[a-z]'`
else
rmdir /usr/lib/locale/${language}.${char_map}
fi
else
[ -s "$LOGFILE" ] || rm -f "$LOGFILE"
fi
done<<EOI
$(ls -1 /usr/share/i18n/charmaps)
EOI
read -p "Press Enter to continue, Cntrl+C to abort :" ENTERKEY
done
|
The script does not alter /etc/profile .
I use it to debug if languages don't compile
f.ex output of de_LU@euro with cp775 :
de_LU@euro.CP775
Something Wrong
/usr/share/i18n/charmaps/CP775:268: unknown character `U00000080'
no output file produced because warnings were issued
NOTE : A /usr/lib/locale/$LANG contains 0,2-1,2MB of files . If run 200maps X 200langs -> SOME MEGA or GIGABYTE .
I have put in interactive mode , to be able to stop it . Also accepts $1 ( aa , af , .. , en , .. , zh , zu ) .
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1715 Location: Burghaslach, Germany
|
Posted: Sun 21 Apr 2013, 09:26 Post subject:
Re: script to create all charmaps for all languages |
|
| Karl Godt wrote: | | .. If run 200maps X 200langs -> SOME MEGA or GIGABYTE ... |
I also do not have some GIGABYTE
But here is my attempt for Danish in Süd-Schleswig:
| /usr/share/i18n/locales/da_DE wrote: | escape_char /
comment_char %
% Locale for Danish in Germany
% Contributed by Ulrich Drepper <drepper@redhat.com>, 2000
% Contributed by L18L for South Schleswig 2013
LC_IDENTIFICATION
title "Danish locale for Germany"
source "Danish Standards Association"
address "Kollegievej 6, DK-2920 Charlottenlund, Danmark"
contact ""
email "bug-glibc-locales@gnu.org"
tel ""
fax ""
language "Danish"
territory "Germany"
revision "1.0"
date "2000-06-29"
%
category "da_DE:2000";LC_IDENTIFICATION
category "da_DE:2000";LC_CTYPE
category "da_DE:2000";LC_COLLATE
category "da_DE:2000";LC_TIME
category "da_DE:2000";LC_NUMERIC
category "da_DE:2000";LC_MONETARY
category "da_DE:2000";LC_MESSAGES
category "da_DE:2000";LC_PAPER
category "da_DE:2000";LC_NAME
category "da_DE:2000";LC_ADDRESS
category "da_DE:2000";LC_TELEPHONE
END LC_IDENTIFICATION
LC_CTYPE
copy "de_DE"
END LC_CTYPE
LC_COLLATE
% Copy the template from ISO/IEC 14651
copy "iso14651_t1"
END LC_COLLATE
LC_MONETARY
copy "de_DE"
END LC_MONETARY
LC_NUMERIC
copy "de_DE"
END LC_NUMERIC
LC_TIME
copy "de_DE"
END LC_TIME
LC_MESSAGES
copy "da_DK"
END LC_MESSAGES
LC_PAPER
copy "de_DE"
END LC_PAPER
LC_NAME
copy "de_DE"
END LC_NAME
LC_ADDRESS
copy "de_DE"
END LC_ADDRESS
LC_TELEPHONE
copy "de_DE"
END LC_TELEPHONE
LC_MEASUREMENT
copy "de_DE"
END LC_MEASUREMENT
| it is just copied from de_DE@euro and manually edited.
Testers from North-Schleswig welcome
-----
[edit] above file da_DE changed after successful test
Last edited by L18L on Sun 21 Apr 2013, 11:26; edited 1 time in total
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1715 Location: Burghaslach, Germany
|
Posted: Sun 21 Apr 2013, 11:25 Post subject:
da_DE Subject description: create locales for real life |
|
above file da_DE changed after successful test
locale da_DE.UTF-8 is reality
|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 2675 Location: Kiel,Germany
|
Posted: Sun 21 Apr 2013, 12:03 Post subject:
|
|
Thanks , L18L . I don't belong to the danish minority . Maybe there is a dk_GL , dk_BH , dk_JL , dk_SL , dk_LL , dk_FY and a dk_OD for all these islanders ?
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1715 Location: Burghaslach, Germany
|
Posted: Sun 21 Apr 2013, 12:44 Post subject:
|
|
| Karl Godt wrote: | Thanks , L18L . I don't belong to the danish minority . Maybe there is a dk_GL , dk_BH , dk_JL , dk_SL , dk_LL , dk_FY and a dk_OD for all these islanders ?
 |
Surely not. There is no language dk
Danish is da
Denmark is DK
Icelandic is is
.....
Why did I post that da_DE to you ?
Just for the contrast to your
script for all ... combined with all ..... good for ?
|
|
Back to top
|
|
 |
Karl Godt

Joined: 20 Jun 2010 Posts: 2675 Location: Kiel,Germany
|
Posted: Sun 21 Apr 2013, 13:28 Post subject:
|
|
Ich kenne keinen Menschen, der GUT ist .
Next time givt dat auffe Mütze Lutz !
|
|
Back to top
|
|
 |
L18L
Joined: 19 Jun 2010 Posts: 1715 Location: Burghaslach, Germany
|
Posted: Thu 25 Apr 2013, 14:36 Post subject:
|
|
Sorry
|
|
Back to top
|
|
 |
|
|
|
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
|