Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Help with Programming.  (Read 1840 times)

Travis_durden

  • Escaped Lunatic
    • View Profile
Help with Programming.
« on: January 18, 2015, 04:56:39 pm »

I'm tryng to translate to Portuguese,
so, I downloaded Visual Express + Source Code + SVN.
I still have no idea about what I'm doing.


Sorry for my bad english.
Logged

SuicideJunkie

  • Bay Watcher
    • View Profile
Re: Help with Programming.
« Reply #1 on: January 18, 2015, 05:41:59 pm »

Can you compile it successfully?

As for the actual translation, the text is spread out among most of the files.
You will have to look into and make changes in almost every one.

Sentence structure may also be a problem for certain things such as the combat.  In combat the strings are built up as the calculation proceeds.  You may need to create extra temporary variables in order to build the sentence after everything is known.
Logged

Travis_durden

  • Escaped Lunatic
    • View Profile
Re: Help with Programming.
« Reply #2 on: January 18, 2015, 07:04:03 pm »

Can you compile it successfully?

As for the actual translation, the text is spread out among most of the files.
You will have to look into and make changes in almost every one.

Sentence structure may also be a problem for certain things such as the combat.  In combat the strings are built up as the calculation proceeds.  You may need to create extra temporary variables in order to build the sentence after everything is known.

to do the translation test i need to run the game. do i need to compile before before run it?

about the combat: i haven't started yet
Logged

Kodiologist

  • Bay Watcher
    • View Profile
    • Personal website
Re: Help with Programming.
« Reply #3 on: January 27, 2015, 05:33:28 pm »

LCS isn't written in a way to make translation easy, like Cataclysm DDA is or so. Just the opposite: the program is riddled with assumptions about the exact lengths of strings. So, the programming work you'd need to do before starting to translate anything is gigantic. It wouldn't be all that much easier than a full rewrite of the game, actually.
Logged

Purple Gorilla

  • Bay Watcher
    • View Profile
Re: Help with Programming.
« Reply #4 on: January 30, 2015, 03:47:18 pm »

I am not familiar with portigeese, but I assume it has a more complex grammar than english (as virtually every language has a more complex grammar than english). In general, you must use C's formating funktions like printf().

*Do you have a grammatical sex (like german) in portugeese ? Then you should at a variable <sex> into the XML files, to give items a sex. Persons already have an ingame sex, but you probably have to change profession names according to sex. English is probably the only language where gender-mainstreaming works. I recomend, to encode the sex into the profession strings, and use a function for every time it is printed, to declinate it. for example use curved brackets to indicate female only letters like "Police{wo}man". If the person is female, the parser simply has to dump the bracets and if he is male, dump the letters inside the bracets, too. The easiest way to do this, is to replace removed letters with a characte that cannot be printed, like SYN or DEL. A simpler, but more memory intensive methode is, to simply use two strings for every profession, one male and one female.
* LCS has a lot of code duplication. Reducing it helps you, as you need to patch less text. Some common strings should be written in global variables and inserted with %s when needed.
* You probaly need an array, of strings (*char[][]) representing the english word the for different case, sex and numerus. C only allows three dimensions, and one is consumed for the strings, so the array must be two dimensional. Im not familiar with portugeese, but in german for example you treat the plural as the fourth sex and use the same dimension for sex and number, so the dimension is (male,femal,neutral,plural). As protugeese has the same descent as french (two sexes, sexed plural), I assume this dimension were (male sing., female sing, male plural,female plural). Other words like his/her might need an array, too, if it is determined by the objects sex and number.
* C has some beautyfull funktions, to handle grammar, but for some reason, LCS never uses them. If you want to allow C escape codes in an LCS funktion, write a wraper, that accepts varargs and uses vspritf() to write the parsed string into a buffer, that apply the LCS funktion to the buffer. This should look like that :

#include <STDARG.H>

char addstrf_buffer[512];

/* Wrapper for addstr to allow formated strings */
void addstrf(const char format,va_list arglist)
{
  vsprintf(addstrf_buffer,format,arglist);
  addstr(addstrf_buffer);
}

/* example of a formated string */
void example(int female,const char *verb,const char *object,const char *reason)
{
 addstrf("The police%sman %s %s %s at you%s.",
       female?"wo":"",
       verb,
       female?"her":"his",
       object,
       reason
 );
}

void main()
{
 /* The policewoman swings her whip at you, for fetish. */
 example(TRUE,"swings","whip",", for fetish");
 /* The policeman fires his .44 magnum at you, because you're black. */
 example(FALSE,"fires",".44 magnum",", because you're black.");
}



Using varargs is a case of advanced C Programming, but it will really help you. It can be used to simplify programming and significently reduce the code size.
Interesting Sources :
* look in your compiler manual for stdarg.h and its funktions
* get a book about advanced C-Programming
* Look at Nethack. The Files PLINE.C and VARARGS.H are very interesting, they contain useage of varargs for every possible platform ever used.  http://nethackwiki.com/wiki/Pline.c

zaimoni

  • Bay Watcher
    • View Profile
Re: Help with Programming.
« Reply #5 on: January 30, 2015, 05:46:22 pm »

I would expect a translation effort like that to be coordinated at the sentence or paragraph level; there would need to be a support subdirectory for each language (mainly because tense/number/gender won't line up exactly between languages).

As mentioned, English has a very simple grammar; it's the extent of the vocabulary that is generally the worst problem.  (I am specifically comparing to French.)  A translation will often have to make a judgement call on the best non-literal way to represent English in the other language.
Logged