Internationalization under Windows...

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #41by Vincent » 14.02.2006, 22:03

Well, I would rather say : Under Windows, this is precisely what gettext should do... :wink:
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #42by Christophe » 14.02.2006, 23:27

Since I'm a bit tired of waiting for a Windows developer to tackle this issue I've started working on it.

The hardest part was actually getting celestia to compile under Windows (it's such an ugly mess, it even made me regret the autotools).

Anyway, Vincent I'm a bit surprised that you got your patch to compile, it doesn't for me. Here is what I did:

1 - Installed gettext, see here. Installed in c:\Program Files\GnuWin32

2 - Added the include/lib/path to celvars.bat:

Code: Select all

@echo off

Set INCLUDE=C:\Program Files\GnuWin32\include;%INCLUDE%
Set PATH=C:\Program Files\GnuWin32\bin;%PATH%
Set LIB=C:\Program Files\GnuWin32\lib;%LIB%

Set PATH=C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin;%PATH%
Set INCLUDE=C:\Program Files\Microsoft Visual C++ Toolkit 2003\include;%INCLUDE%
Set LIB=C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib;%LIB%

Set INCLUDE=C:\Program Files\Microsoft Platform SDK\include;%INCLUDE%
Set INCLUDE=C:\Program Files\Microsoft Platform SDK\include\mfc;%INCLUDE%
Set LIB=C:\Program Files\Microsoft Platform SDK\Lib\IA64\mfc;%LIB%;C:\Program Files\Microsoft Platform SDK\Lib


3 - Applied your patch with a few fixes:
in src/celestia/celestia.mak replaced intl.lib by libintl.lib in LINK32_FLAGS
in src/celutil/util.h kept the ifdef block:

Code: Select all

#ifdef _WIN32
#include "libintl.h"
#define _(s) gettext(s)
#else
#define _(s) gettext(s)
#endif


Now it builds. I have no idea if it runs or not since I'm doing this through RDC on a computer at work. I'll check it tomorrow.
Christophe

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #43by Christophe » 15.02.2006, 13:16

Isn't it beautiful?

Image

I had to rename the overlay::printf method, since intl.h has the very bad idea of define'ing printf as libintl_printf.

There is still quite a bit of work to be done:
- Automate language selection
- tweak the makefile to build and install the catalog files
- fix the Win32 GUI code to understand UTF-8
- include translated ressource files to provide translated menus and dialogs.

But we're definitely on the right tracks.
Christophe

Topic author
Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #44by Vincent » 15.02.2006, 14:30

Christophe,

Thanks a lot for taking the time to dive into the "Windows jungle" :wink:

Here are a few questions :
- Where and how did you rename the Overlay::printf method ? I made some changes in overlay.cpp but I get an error while compiling.
- Where did you put the fr.gmo file ?

Thanks again.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #45by Christophe » 15.02.2006, 14:42

In overlay.cpp I replaced overlay::printf by overlay::oprintf.
I also made the change in overlay.h and celestiacore.cpp (replace all occurrences of overlay.printf by overlay.oprintf).

In winmain.cpp I also changed the path in bintextdomain:

Code: Select all

bindtextdomain("celestia","C:/Program Files/GnuWin32/share/locale");


And finaly, I put celestia.mo in C:/Program Files/GnuWin32/share/locale/fr/LC_MESSAGES/. (this will eventualy be moved to a subfolder of the celestia installation.)
Christophe

Topic author
Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #46by Vincent » 15.02.2006, 15:19

Christophe,

I made all the changes you suggested, and the compilation went fine.
Then, I pasted the libiconv2.dll and the libintl3.dll files in the Celestia root folder since Celestia asked for them.

Then, I set the LANG option and ran Celestia from the command window :

Code: Select all

set LANG=fr_FR
.\celestia.exe


But I still can't see the translated strings.

In your last post, you were refering to the intl.h file. I can't find it in GnuWin32. I have the libintl.h file instead that I pasted in the ...\inc folder.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #47by Christophe » 15.02.2006, 15:43

Yes, you're right, it's libintl.h, not intl.h. You don't need to copy it to inc if you set INCLUDE as I suggested above.

You do need to copy the two dll.

The interesting thing, is that I can't seem to get it to use anything else but French, whatever the value of LC_ALL or LANG. This is on a French version of Windows.
Christophe

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #48by Christophe » 15.02.2006, 16:50

Another thing, if you changed util.h you need to do a "makerelease.bat clean" before rebuilding.
Christophe

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #49by Christophe » 15.02.2006, 17:59

Ok, I get it now. The documentation is apparently outdated.

Launching Celestia in the default environment causes it to use the system locale setting (this is good, one thing less to do).

To use another language, you need to set the LANGUAGE environment variable, for example:

Code: Select all

Set LANGUAGE=es
celestia.exe
Christophe

Topic author
Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #50by Vincent » 15.02.2006, 19:43

Christophe,

I can't figure out why it's still not working on my system. Not only is the documentation outdated, but it seems to be wrong too : the GnuWin32 FAQ says that the linker has to find the intl.lib file. But you used the libintl.lib file instead...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Topic author
Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Post #51by Vincent » 15.02.2006, 21:01

OK, it's working now ! :D

The problem didn't come from the code, but from the celestia.mo file. After converting the .po file with Msgfmt, I got a celestia.gmo file instead of the celestia.mo file... I still don't know why... I copied your celestia.mo file in my system and everything went fine.

Now, I'm going to test your binary on a default 1.4.1 package, with the locale folder included in the Celestia root folder.

Thanks Christophe.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

georgiouk
Posts: 47
Joined: 02.05.2005
With us: 19 years 6 months
Location: Greece

Post #52by georgiouk » 01.03.2006, 11:17

Hello.
I am also trying to translate Celestia using your way and I have some questions
Where can I get the celestia.mo?
Where I set the LANGUAGE environment variable?

Thanks. :)

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #53by Christophe » 01.03.2006, 11:39

celestia.mo is the compiled form of your catalog file (.po file).

Follow the instructions on http://celestia.teyssier.org/download/win32/
Christophe

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #54by t00fri » 01.03.2006, 12:42

I am also getting impatient. Since years I am compiling the CVS Windows executable in parallel to Linux, to make sure that things remain compatible. Since Chris' last I18N commit (including the new winlibs), my VS+-2003 environment goes crazy, stating that intllib.h and other includes cannot be found anymore (despite correct paths) ...
I didn't have the time yet to dig myself through this mess...

I strongly urge better testing of Windows commits in the furture!
It costs a lot of time to mess around with such sloppy /half working stuff.

Bye Fridger

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #55by Christophe » 01.03.2006, 12:59

Fridger, maybe that would have helped if people had actually tested the patch and reported any problem.

I know you're not interested in i18n, but if you'd taken the time of a simple compilation test then you'd have saved yourself spending time on it now. It's not as if I'd dropped the thing on CVS without any notice.

I have access to only one (ancient) Windows box, without VS, I used the VC++ Toolkit and SDK and it worked fine there. I'm sorry to hear MS development tools are inconsistent.
Christophe

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #56by selden » 01.03.2006, 13:17

The updated version of winlibs-new.zip is available now. I had no problems building and running Celetia from CVS this morning. I use makerelease.bat, however, and the default US English interface.
Selden

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #57by t00fri » 01.03.2006, 13:36

Christophe wrote:Fridger, maybe that would have helped if people had actually tested the patch and reported any problem.

I know you're not interested in i18n, but if you'd taken the time of a simple compilation test then you'd have saved yourself spending time on it now. It's not as if I'd dropped the thing on CVS without any notice.

I have access to only one (ancient) Windows box, without VS, I used the VC++ Toolkit and SDK and it worked fine there. I'm sorry to hear MS development tools are inconsistent.

Christophe,

my above remark was not to your address, but rather to the one of Chris. It's that sort of thing, for example:

Selden wrote:Chris wrote
> Christophe's i18n work for Windows adds a dependency on the a new library.
> I've added libintl.h to winlibs and uploaded a new version:

> http://www.celestiaproject.net/celestia/files/winlibs-new.zip

Well, maybe you intended to do so, but it's still the old version,
dated 24-Aug-2004 :-(


...and so on...That was 2 1/2 half days ago, already.

After all, Chris is taking responsability for the Windows part.

Indeed, I am not at all interested in I18N, but I do have a vivid interest to test my core code versus Windows regularly and without unnecessary loss of time!

Bye Fridger

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #58by t00fri » 01.03.2006, 13:38

selden wrote:The updated version of winlibs-new.zip is available now. I had no problems building and running Celetia from CVS this morning. I use makerelease.bat, however, and the default US English interface.


Thanks for the info, Selden,

so I'll try once more tonight....

Bye Fridger

Christophe
Developer
Posts: 944
Joined: 18.07.2002
With us: 22 years 4 months
Location: Lyon (France)

Post #59by Christophe » 01.03.2006, 13:58

I understand Fridger.

What I'm getting really frustrated with is the apparent total lack of windows dev interest in the project.

The windows user base is what? something like 20 times that of the other platforms? and we have a grand total of one active developer (Chris nonetheless), if ratios of users held we should have something like a hundred! a real army. I really don't get this, are windows developers generaly incompetent? a bunch of freeloaders?

I know some developers release their own patched version of Celestia, why do they keep to themselves and don't get more involved in the project as a whole?
Christophe

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #60by t00fri » 01.03.2006, 14:15

Christophe wrote:I understand Fridger.

What I'm getting really frustrated with is the apparent total lack of windows dev interest in the project.

The windows user base is what? something like 20 times that of the other platforms? and we have a grand total of one active developer (Chris nonetheless), if ratios of users held we should have something like a hundred! a real army. I really don't get this, are windows developers generaly incompetent? a bunch of freeloaders?

;-) Obviously Windows users are fluently speaking English ...
So does Bill Gates.

I know some developers release their own patched version of Celestia, why do they keep to themselves and don't get more involved in the project as a whole?


Yes, fine, but honestly I wouldn't be all that happy to see these patches in the official version...There are many things I would have to say here...


Bye Fridger


Return to “Development”