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 Sat 25 May 2013, 10:26
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Question about gettext! [SOLVED]
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 3 [38 Posts]   Goto page: Previous 1, 2, 3 Next
Author Message
Argolance


Joined: 06 Jan 2008
Posts: 1381
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Sat 21 Jan 2012, 17:00    Post subject:  

Hello,
Not sure but I think I am understanding what RSH means (??):
If an application is localized with the shinobar's simple script based on MU for example, mo files can be simply created with any text editor and later edited with! These mo files have got the same extension and are copied in the same places but are not of the same sort than those which are directly created to work with gettext from po file. So, inside /usr/share/locale directories, one can find mo files that can be edited, and the others that cannot be and seem to be empty when edited though!

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
RSH


Joined: 05 Sep 2011
Posts: 1564
Location: Germany

PostPosted: Sat 21 Jan 2012, 23:19    Post subject:  

Question about gettext!

What do i have to put into the code to use GETTEXT in my own programs?

L18L wrote:
I have no idea what you are talking about and so cannot reproduce your problem:
Some of the .mo files are empty, if i open them to edit - while others opens as they should.


Title: GUI for editing .mo files
http://murga-linux.com/puppy/viewtopic.php?t=73321

RSH wrote:
Hello,

i have created a little GUI to edit the .mo files. Drag & drop the .mo file into the textfield at the GUI and the .mo file will be converted to .po file and automatically loaded into geany or leafpad (if geany is not available).

You can get the tool right here. It has got an english GUI and a german GUI.
http://murga-linux.com/puppy/viewtopic.php?p=581538#581538

I hope, this is a useful tool to you. I have enjoyed to create this little pet.

My best wishes,

RSH

@L18L:
You have seen this already - then.

BarryK wrote:
RSH,
That is a very useful tool, I will put it into Racy and Wary I reckon (well, I have to try it first!)

@L18L:
You have seen this already - also then.

---

So, i think it is absolutely clear:

Talking or writing about editing the .mo files does mean: convert the .mo to .po and load the .po into a texteditor (geany, notepad etc.).

Except: you are running human language under the rules of programming languages!

F.E. (to eat some): stand up. leave the room were you are actually in. go to the kitchen. open the refrigerator. take what you want. eat.

Or in assemmbler: move your arms. push your body up and get on the feet. move right feet 40cm forward. step down. move left feet...

Mein Gott!

I think you are doing a little bit of HAARSPALTEREI here? Wink

I will search the files and reproduce what i wanted to describe and get a solution for in here. I will make notes and screenshots and come back to this point when it's done.

Thanks

RSH


Edit:
Argolance wrote:
So, inside /usr/share/locale directories, one can find mo files that can be edited, and the others that cannot be and seem to be empty when edited though!


Right!

Thank you.

_________________
Useful Software for Puppy!
LazY Puppy - a Paradise Puppy! - DE & EN ISO 2.0.2-0.0.5 available
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1381
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Sun 22 Jan 2012, 08:36    Post subject:  

Hello,
(out of subject)
HAARSPALTEREI! French are used to say: "Couper les cheveux en quatre" (and sometimes somewhat more coarse! Very Happy) and English: "Hairsplitting"!
I rather think things are quite difficult to explain or understand for non English speaking guys...

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
Argolance


Joined: 06 Jan 2008
Posts: 1381
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Mon 23 Jan 2012, 14:46    Post subject:  

Hello,
Thank you L18L: Perfect!
I should say almost perfect: My mo file is taken in account and French words are displayed in the application Very Happy.
The problem now (problem that I already encountered several times and which made me unfortunately be a bit... wary with gettext because I finally could not solve it and gave up!) The problem now is accentuation... I tried UTF-8, ISO-8859-1... but didn't succeed to get accents.

This time, I would have liked to understand what's going wrong and solve this problem for good!

Cordialement!

_________________

Back to top
View user's profile Send private message Visit poster's website 
Argolance


Joined: 06 Jan 2008
Posts: 1381
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Wed 25 Jan 2012, 07:56    Post subject:  

Hello,
Quote:
This time, I would have liked to understand what's going wrong and solve this problem for good!

End of this little saga: This problem appears only with Puppy/Toutou 4.31 and as long as it was not possible to compile (retrovol in particular and other applications in general) with Wary 5.2.2 (=> BarryK made a pet package to correct this issue, posted on 9 Dec 2011), I could not test and diagnose that my French translation was finally working as well as possible!

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 3843

PostPosted: Wed 25 Jan 2012, 11:26    Post subject:  

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.

_________________
Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 2422

PostPosted: Wed 25 Jan 2012, 12:41    Post subject:  

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.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 3843

PostPosted: Wed 25 Jan 2012, 12:59    Post subject:  

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)

_________________
Puppy Web Desktop Now with pet packages - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 2422

PostPosted: Wed 25 Jan 2012, 13:38    Post subject:  

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.
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1381
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Thu 26 Jan 2012, 11:53    Post subject:  

Hello,
Thank you to all of you!
Quote:
The standard is --prefix=/usr --sysconfdir=/etc --localstatedir=/var
Saved!
Quote:
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.

_________________

Back to top
View user's profile Send private message Visit poster's website 
sc0ttman


Joined: 16 Sep 2009
Posts: 2175
Location: UK

PostPosted: Thu 26 Jan 2012, 13:21    Post subject:  

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:
 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:
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

_________________
Akita Linux, VLC-GTK, Pup Search, Pup File Search
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1381
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 27 Jan 2012, 11:29    Post subject: UTF-8 and ISO-xxx!
Subject description: How does it work with gettext?
 

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:
Quote:
(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!) Shocked
    - Both don't work with Wary 5.2.2 if checkbox UTF-8 deactivated Shocked Shocked
    - Both work fine with Wary 5.2.2 if checkbox UTF-8 activated Shocked Shocked Shocked



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

Will soon have a puncture. Very Happy

Regards.

_________________

Back to top
View user's profile Send private message Visit poster's website 
Karl Godt


Joined: 20 Jun 2010
Posts: 2682
Location: Kiel,Germany

PostPosted: Sat 28 Jan 2012, 06:42    Post subject:  

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


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

Code:
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 .
Back to top
View user's profile Send private message Visit poster's website 
L18L

Joined: 19 Jun 2010
Posts: 1723
Location: Burghaslach, Germany

PostPosted: Sat 28 Jan 2012, 07:49    Post subject: Re: UTF-8 and ISO-xxx!
Subject description: How does it work with gettext?
 

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 Smile

Code:
OUTPUT_CHARSET=UTF-8 retrovol

did it right and
Code:
export OUTPUT_CHARSET=UTF-8

did make retrovol start permanently using utf8
Code:
retrovol


Quote:

#
# 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 Very Happy

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 Question
retrovol.png
 Description   locale without utf8
"Volume" translated correctly to "Lautstärke"
 Filesize   3.04 KB
 Viewed   462 Time(s)

retrovol.png

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


Joined: 06 Jan 2008
Posts: 1381
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Sat 28 Jan 2012, 10:21    Post subject:  

Hello,
Thank you for replying.
... Feel much better now! Very Happy
Puppy/Toutou 4.31:
In console:
Quote:
OUTPUT_CHARSET=UTF-8 retrovol -hide
This finally works!
Adding this line to /etc/profile:
Quote:
export OUTPUT_CHARSET=UTF-8

This unfortunately does not!
Is there a right place to put the line?
This is what I did:
Quote:
#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):
Quote:
#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.
retrovol.png
 Description   
 Filesize   23.13 KB
 Viewed   492 Time(s)

retrovol.png


_________________


Last edited by Argolance on Sat 28 Jan 2012, 14:02; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 2 of 3 [38 Posts]   Goto page: Previous 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
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.0997s ][ Queries: 13 (0.0083s) ][ GZIP on ]