gettext and define

Discuss and coordinate development of mainline and user-made content translations.

Moderators: Forum Moderators, Developers

Post Reply
Atanase
Posts: 7
Joined: June 17th, 2019, 1:50 pm
Location: Béarn (France)

gettext and define

Post by Atanase » June 18th, 2019, 9:25 am

Hello,

I don't know if I am in the good subject. If not, thank you to move this post.

I am trying to translate a user's campaign. I use PoEdit and wmlxgettext, like everybody, to prepare my .pot file. But.......
Many unit's definitions use many "#define" and, if the opening tag [unit_type] is in the unit's file, the closing tags [/unit_type] is in the include. So wmlxgettext refuse to give me the original messages and stop on error, doing nothing.

I think that I am not the first to have this kind of problem.

Is somebody knowing a "pre-processor" which could give me a "result file" with the #define included ? Maybe a part of the official loader of the game ?

As I did not write programs from very long time, maybe 10 or 15 years, if I try to write it I will loose at least 2 or 3 weeks.

As may grand-mother said : Better 1 who knows than 2 who search. ;)

Thank you for your help.
Celui qui dans la vie, est parti de zéro pour n'arriver à rien dans l'existence n'a de merci à dire à personne.
Pierre Dac

oooo
Posts: 8
Joined: May 14th, 2014, 12:58 pm
Location: Japan

Re: gettext and define

Post by oooo » June 18th, 2019, 11:41 am

I immediately noticed your problem when I read this subject ;)

I had suspected that the current version of wmlxgettext cannot handle WML sources which have some macros, same as the old perl version.

I'm not sure this is what you want, but I have a modified wmlxgettext. Its original version was included in 1.12.1, and written by perl.

I simply modified it to ignore errors. Maybe I also corrected some problems but I don't remember them.

It can create a pot file of LotI.
Attachments
wmlxgettext.zip
(3.9 KiB) Downloaded 77 times

User avatar
octalot
Developer
Posts: 406
Joined: July 17th, 2010, 7:40 pm

Re: gettext and define

Post by octalot » June 18th, 2019, 12:32 pm

Atanase wrote:
June 18th, 2019, 9:25 am
Is somebody knowing a "pre-processor" which could give me a "result file" with the #define included ? Maybe a part of the official loader of the game ?
Method 1: Use the --preprocess option to wesnoth, for example to output to a directory called "temp"

Code: Select all

wesnoth --preprocess Defense_of_Elensefar temp --preprocess-defines CAMPAIGN_DEFENSE_OF_ELENSEFAR,HARD
Method 2: If you have a search program that can search compressed files, there is a preprocessed version in Wesnoth's cache directory, but you'll need a search program to find out which file is yours. If the campaign has multiple difficulties there then will be one per difficulty, note that these are only created when you play on that difficulty.

Atanase
Posts: 7
Joined: June 17th, 2019, 1:50 pm
Location: Béarn (France)

Re: gettext and define

Post by Atanase » June 18th, 2019, 4:11 pm

Hello,

Thank you for your answers and also for your speed. ;)

I will try the two methods.

The oooo method seems good to see what must be done to play.
The octalot methods better to see what is really done when you play.
Celui qui dans la vie, est parti de zéro pour n'arriver à rien dans l'existence n'a de merci à dire à personne.
Pierre Dac

Atanase
Posts: 7
Joined: June 17th, 2019, 1:50 pm
Location: Béarn (France)

Re: gettext and define

Post by Atanase » June 18th, 2019, 9:20 pm

Hello,

Last news from the front :

The wmlxgettext from oooo work very fine. But...... Not for the lua files. :lol:

So I used the new to create a "special" file and merged it with the main.

Now I hope that I have really ALL the sentences.

Have a good night.
Celui qui dans la vie, est parti de zéro pour n'arriver à rien dans l'existence n'a de merci à dire à personne.
Pierre Dac

oooo
Posts: 8
Joined: May 14th, 2014, 12:58 pm
Location: Japan

Re: gettext and define

Post by oooo » June 19th, 2019, 12:53 pm

Atanase wrote:
June 18th, 2019, 9:20 pm
The wmlxgettext from oooo work very fine. But...... Not for the lua files. :lol:
Uhm, It seems to work fine to me, but I'm not quite sure because I recently don't play LotI.

I use the wmlxgettext with following command line which specifies all cfg and lua files explicitly.

Code: Select all

wmlxgettext --directory $DIR --domain $DOM --initialdomain $DOM `cd $DIR && find -name '*.cfg' -o -name '*.lua' | sort`

Atanase
Posts: 7
Joined: June 17th, 2019, 1:50 pm
Location: Béarn (France)

Re: gettext and define

Post by Atanase » June 20th, 2019, 7:37 am

Hello,

No matter, I wrote a little shell script (only 4 lines with the #! /bin/sh) with a 'msgcat' and all is done.

It was just a ;)

Thank you again for your help.

Have a good day or night wherever you are.
Celui qui dans la vie, est parti de zéro pour n'arriver à rien dans l'existence n'a de merci à dire à personne.
Pierre Dac

Post Reply