Question about gettext! [SOLVED]

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#21 Post by technosaurus »

You have stumbled upon one problem that is frequently encountered in pet packages made by inexperienced packagers .. failing to set prefix, sysconfdir and othersto the appropriate directories. By default puppy is set up to build _personal_ package with prefixed set to /usr/local and the rest get prefixed with that (ex. Sysconfdir would be /usr/local/etc instead of /etc)

The standard is --prefix=/usr --sysconfdir=/etc --localstatedir=/var
The rest are based on these and should typically be ok(with a few exceptions)

However, some vigilance is required when doing this on package that use Makefiles or hardcode a path in source. If this is necessary, it is a good idea to post a patch to ensure compatibility in future builds.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#22 Post by jpeps »

technosaurus wrote:You have stumbled upon one problem that is frequently encountered in pet packages made by inexperienced packagers .. failing to set prefix, sysconfdir and othersto the appropriate directories. By default puppy is set up to build _personal_ package with prefixed set to /usr/local and the rest get prefixed with that (ex. Sysconfdir would be /usr/local/etc instead of /etc)
.
..or set "make DESTDIR=/$APP install" so you can view and edit everything prior to making the pet.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#23 Post by technosaurus »

jpeps wrote:..or set "make DESTDIR=/$APP install" so you can view and edit everything prior to making the pet.
NO!!! That is absolutely the _wrong_ thing to do.
These parameters get used to make the config.h file and the paths are compiled into the binaries. Moving them around is exactly what breaks them. Unfortunately there is no equivalent to PATH and LD_LIBRARY_PATH for things like locale, sysconf, data ... yes it would be nice for the user to be able to set SYSCONF_PATH=/etc:/usr/etc:/usr/local/etc ... and would be extremely convenient for programs to use as well, (this was sort-of discussed previously, but I can't seem to find the thread)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#24 Post by jpeps »

technosaurus wrote:
jpeps wrote:..or set "make DESTDIR=/$APP install" so you can view and edit everything prior to making the pet.
NO!!! That is absolutely the _wrong_ thing to do.
These parameters get used to make the config.h file and the paths are compiled into the binaries. Moving them around is exactly what breaks them.
I guess my rearrangements have involved /usr to /usr/local, both of which are in PATH. I like to look at and test everything before building the pet. Yeah...you can't willy-nilly move around system's files that haven't been configured correctly.

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

#25 Post by Argolance »

Hello,
Thank you to all of you!
The standard is --prefix=/usr --sysconfdir=/etc --localstatedir=/var
Saved!
I could not test and diagnose that my French translation was finally working as well as possible!
I have to say that my mo file only works if UTF-8 is activated (checkbox at the bottom of the locale parameters window - Wary 5.2.2).

For this thread to be actually '(solved'), I still have a simple novice question: Something very confuse stays in my mind about the way to use UTF-8 and ISO-8859-1 (for example!).
How and when use the one or the other? For example, my (retrovol) mo file is build from an UTF-8 pot file and I presume that mo file automatically generated with poeditor is UTF-8 too. This runs quite well, as said above, only if UTF-8 is activated! So why UTF-8 is not the default setting and why ISO-XXX-XX?

For us, non English speaking guys, it is really so many problems (I lost my hair so many times!) due to something that appears like a lack of unity/clarity! => I know that BarryK is seriously looking for this and trying to rationalize Puppy localization process, up stream. We are working, translating, localizing here and there, using different ways to do it, downstream: the result is necessarily incoherent and a lot of time is wasted...

This has to change, indeed! :wink:

Best regards.

User avatar
sc0ttman
Posts: 2812
Joined: Wed 16 Sep 2009, 05:44
Location: UK

#26 Post by sc0ttman »

This code (below) helped me check which are 'real' .mo files, and which are text files...
I plan to rename all fake .mo files in my puplet to .locale files...
Any thoughts on that are welcome!

The check:

Code: Select all

 for x in /usr/share/locale/ru/LC_MESSAGES/*; do echo "$(file "$x" | head -1 | cut -f1 -d'(' | cut -f7 -d'/')" ; done
My results:

Code: Select all

bootflash.mo: GNU message catalog
bootmanager.mo: UTF-8 Unicode text, with very long lines
browser-installer.mo: UTF-8 Unicode text
check_deps.mo: UTF-8 Unicode text
connectwizard.mo: UTF-8 Unicode text
countrywizard.mo: GNU message catalog
defaults-chooser.mo: UTF-8 Unicode text
desksetup.mo: UTF-8 Unicode text
dialog.mo: GNU message catalog
dotpup.mo: UTF-8 Unicode text
drive_mounter.mo: UTF-8 Unicode text
epdfview.mo: GNU message catalog
eventmanager.mo: UTF-8 Unicode text, with very long lines
ffconvert.mo: GNU message catalog
flash.mo: GNU message catalog
frugalinstaller.mo: GNU message catalog
grub4dosconfig.mo: GNU message catalog
gtkspell.mo: GNU message catalog
jwmconfig.mo: GNU message catalog
jwm.mo: GNU message catalog
minimum-profit.mo: GNU message catalog
mtpaint.mo: GNU message catalog
net-setup.mo: UTF-8 Unicode English text
pcdripper.mo: UTF-8 Unicode text
pgprs.mo: GNU message catalog
pkg_chooser.mo: UTF-8 Unicode text
pman.mo: GNU message catalog
pmount.mo: UTF-8 Unicode text, with very long lines
pppoe.mo: GNU message catalog
proxy-setup.mo: GNU message catalog
pup-advert-blocker.mo: UTF-8 Unicode text
pupdial.mo: GNU message catalog
puppy-desktop.mo: GNU message catalog
pupradio.mo: GNU message catalog
pupsaveconfig.mo: GNU message catalog
resizepfile.mo: GNU message catalog
sfsconvert.mo: GNU message catalog
sfs_load.mo: GNU message catalog
startups.mo: UTF-8 Unicode C++ program text
toggle-rox-desktop.mo: UTF-8 Unicode text
viewnior.mo: GNU message catalog
welcome.mo: GNU message catalog
wizard.mo: GNU message catalog
xarchiver.mo: GNU message catalog
Xdialog.mo: GNU message catalog
xfdiff.mo: GNU message catalog
xkb.mo: GNU message catalog
xorgwizard.mo: GNU message catalog
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]

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

UTF-8 and ISO-xxx!

#27 Post by Argolance »

Hello,
I created two mo files: one UTF-8 encoded from UTF-8 encoded po file, an other ISO encoded from ISO encoded po file. These one seem not to be recognized as ISO encoded files:
(retrovol:6585): Gtk-WARNING **: Invalid input string

(retrovol:6585): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()
  • - Both don't work with Puppy/Toutou 4.31 regardless of the locale setting (checkbox UTF-8 activated or not!) :shock:
    - Both don't work with Wary 5.2.2 if checkbox UTF-8 deactivated :shock: :shock:
    - Both work fine with Wary 5.2.2 if checkbox UTF-8 activated :shock: :shock: :shock:
Image

Please, need help or some link to understand what's wrong, what has to be done...

Will soon have a puncture. :D

Regards.

User avatar
Karl Godt
Posts: 4199
Joined: Sun 20 Jun 2010, 13:52
Location: Kiel,Germany

#28 Post by Karl Godt »

Short : The 4.3 Puppy locale file had a wrong entry for the german language


/mnt/sda3/usr/share/i18n/locales/de_DE :

Code: Select all

LC_COLLATE

%define DIACRIT_FORWARD

% Copy the template from ISO/IEC 14651
copy "iso14651_t1"

END LC_COLLATE
where i had to comment the diacrit_forward line to make some things to work (cant remember exactly anymore)
Lupu worked ok .

I have also troubles with Xlib at 4.3 saying locale not supported by its library .

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

Re: UTF-8 and ISO-xxx!

#29 Post by L18L »

I have been playing with retrovol with and without utf8 in latest slacko.

1st problem was:
Could not change to my locale without utf8

So I had to start freshly using very latest slacko (5135)
deactivating UTF-8 and there is some success to report now :)

Code: Select all

OUTPUT_CHARSET=UTF-8 retrovol
did it right and

Code: Select all

export OUTPUT_CHARSET=UTF-8
did make retrovol start permanently using utf8

Code: Select all

retrovol
#
# export OUTPUT_CHARSET=UTF-8
# echo $OUTPUT_CHARSET
UTF-8
# echo $LANG
de_DE
# locale -a
C
de_DE
en_US
POSIX
# retrovol

(retrovol:26732): Gtk-WARNING **: GtkSpinButton: setting an adjustment with non-zero page size is deprecated
Credits go to shinobar who reported first about the OUTPUT_CHARSET thing :D

This has been the problem solver with BaCon too and now with a C programm (gettext is independent of the used programming language).
I suggest to put export OUTPUT_CHARSET=UTF-8 into /etc/profile
______________________

Time for a retrovol_NLS.pet :?:
Attachments
retrovol.png
locale without utf8
"Volume" translated correctly to "Lautstärke"
(3.04 KiB) Downloaded 695 times

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

#30 Post by Argolance »

Hello,
Thank you for replying.
... Feel much better now! :D
Puppy/Toutou 4.31:
In console:
OUTPUT_CHARSET=UTF-8 retrovol -hide
This finally works!
Adding this line to /etc/profile:
export OUTPUT_CHARSET=UTF-8
This unfortunately does not!
Is there a right place to put the line?
This is what I did:
#this line gets edited by chooselocale script...
LANG=fr_FR
export LANG
LC_ALL=fr_FR
export LC_ALL
LANGUAGE=fr_FR
export LANGUAGE

export OUTPUT_CHARSET=UTF-8
Tried something else which works: modifying/completing existing lines in /root/.xinitrc (hidden file):
#v3.91 volume tray applet, thanks to hairywill... v3.96 MENU_BG variable...
if [ "$(which retrovol)" != "" ];then
if [ "$MENU_BG" = "" ];then
export OUTPUT_CHARSET=UTF-8
retrovol -hide &
else
export OUTPUT_CHARSET=UTF-8
retrovol -hide -bg "$MENU_BG" &
fi
fi
Is it right? Good/bad thing?

Will try with Wary 5.2.2 later...

Cordilalement.
Attachments
retrovol.png
(23.13 KiB) Downloaded 664 times
Last edited by Argolance on Sat 28 Jan 2012, 18:02, edited 1 time in total.

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

#31 Post by Argolance »

Hello,
Wary 5.2.2:
Adding line inside /etc/profile doesn't work! (Don't know if I copied the line at the right place, as mentioned above!)
This works when completing /Startup/retrovol_tray:
#!/bin/sh

#exec retrovol -hide ${BGOPT} #BGOPT is exported from /usr/sbin/delayedrun.

#retrovol 0.10, -bg option no longer needed...
export OUTPUT_CHARSET=UTF-8
exec retrovol -hide
Cordialement.

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

export OUTPUT_CHARSET=UTF-8

#32 Post by L18L »

Argolance wrote:Is there a right place to put the line?
Sorry, my quick shot /etc/profile is not good for this.
echo $OUTPUT_CHARSET shows UTF-8 but retrovol has been started earlier.

I did not find a file called xinitrc in my running slacko so I have put

Code: Select all

OUTPUT_CHARSET=UTF-8
export OUTPUT_CHARSET
at the beginning of /usr/sbin/delayedrun and it works (showing correct messages from beginning without utf8 locale)

I am sure Barry will put that code into the right location if there is a better one than delayedrun. The entire system can benefit from this and not just retrovol.

______________________

Time for a retrovol_NLS.pet :?:

_______________________

Edited after seen Argolance´s last post:
There is no Startup/retrovol_tray in slacko !!!

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

#33 Post by Argolance »

Hello,
I did not find a file called xinitrc in my running slacko
/root/.xinitrc? (hidden file)
Time for a retrovol_NLS
I sent the French UTF-8 mo and po files to Pizzasgood (=> http://www.murga-linux.com/puppy/viewtopic.php?t=50744)
The entire system can benefit from this and not just retrovol.
Yes! It is ok! ... and better! Will test when back home.

Best regards

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

export OUTPUT_CHARSET=UTF-8

#34 Post by L18L »

Argolance wrote:/root/.xinitrc? (hidden file)
:D :oops: :oops: :oops: :D

Yes, and delayedrun is launched near the end of /root/.xinitrc :oops:
So the best location seems to be the beginning of /root/.xinitrc or even PUPSTATE which could be launched from sort of fido/.xinitrc, too.
Argolance wrote:I sent the French UTF-8 mo and po files to Pizzasgood (=> http://www.murga-linux.com/puppy/viewtopic.php?t=50744)
And so will I :)
Thank you.

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

gettext with and without utf8

#35 Post by L18L »

L18L wrote:I have been playing with retrovol with and without utf8 in latest slacko.

1st problem was:
Could not change to my locale without utf8
...
Started with utf8

# locale -a
C
de_DE.utf8
en_US
POSIX
#
----------------
chooselocale: choose de_DE without utf8

# locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory

C
de_DE.utf8
en_US
en_US.utf8
POSIX
#

----------------
Bugfix in /usr/sbin/chooselocale:
#120129 enabling adding locale without utf8 using regexp. L18L

#if [ "`locale -a | grep "${LANGCHOICE}${UTF8}"`" = "" ];then
if [ "`locale -a | grep -E "${LANGCHOICE}${UTF8}$"`" = "" ];then #120129
----------------

chooselocale: choose de_DE without utf8

# locale -a
C
de_DE
de_DE.utf8
en_US
en_US.utf8
POSIX
#

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

#36 Post by Argolance »

Hello L18L,
#120129 enabling adding locale without utf8 using regexp. L18L

#if [ "`locale -a | grep "${LANGCHOICE}${UTF8}"`" = "" ];then
if [ "`locale -a | grep -E "${LANGCHOICE}${UTF8}$"`" = "" ];then #120129
If I well undertood, this has to be copied into /usr/sbin/chooselocale? And this instead of all the different "solutions" called above? But where?

... And what about the commented line? What is it used for? then... then what?
Sorry to ask so many questions...

Thank you!

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

bugfix for chooselocale

#37 Post by L18L »

Hello Argolance,

yes, edit /usr/sbin/chooselocale
find the line

Code: Select all

if [ "`locale -a | grep "${LANGCHOICE}${UTF8}"`" = "" ];then

it is something like 147 and replace it by:

Code: Select all

if [ "`locale -a | grep -E "${LANGCHOICE}${UTF8}$"`" = "" ];then
No, this is just a bugfix which enables you now to choose for example fr_FR if you have started using fr_FR.UTF-8

The other issue was to have OUTPUT_CHARSET=UTF-8 permanent.
Put

Code: Select all

export OUTPUT_CHARSET=UTF-8
into /root/.xinitrc

Cordialment :)

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

#38 Post by Argolance »

Thank you a lot: now, all is just and perfect indeed!

Herzlich! :wink: :D

Post Reply