Jump to content

r17251: Multilanguage Support


Euphy

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Multilanguage Support

r17251 extends the functionality of rAthena's map-server message system to support other languages. When enabled, players are able to set a language to receive self-information messages, notably from atcommands. This setting is stored as the #langtype variable in `global_reg_value` (default 0, or English). Note that adding additional languages consume RAM, so all languages besides English are disabled by default.

Adding a Language

Languages are defined in a bitmask in trunk/src/common/msg_conf.h:

enum lang_types {
	LANG_RUS = 0x01,
	LANG_SPN = 0x02,
	LANG_GRM = 0x04,
	LANG_CHN = 0x08,
	LANG_MAL = 0x10,
	LANG_IDN = 0x20,
	LANG_FRN = 0x40,
	LANG_POR = 0x80,
	LANG_THA = 0X100,
	LANG_MAX
};
// Multilanguage System.
// Define which languages to enable (bitmask).
// 0xFFF will enable all, while 0x000 will enable English only.
#define LANG_ENABLE 0x000
Add values for languages you want to enable, then recompile.

Setting a Language

The @langtype command will allow players to switch their language setting:

@langtype <language>

Changes the language attached to the player's account (#langtype).

If no parameter is given, a list of available languages is displayed.

All languages are defined in '/src/common/msg_conf.h'.

For example, typing @langtype SPN will make all messages display in Spanish.

Language Files

All language files are stored in the trunk/conf/msg_conf/ directory as map_msg_***.conf. Custom messages may be stored inside the 'import' directory for easy updating.

When the server reads a line from a language file, you may receive debug messages for the following cases:

  • The line is missing from the translation file.
  • The language is enabled, but the table is missing.
In both cases, the server will output the English line as a fallback.

(As of now, not all translations are complete.)

Other Changes

The msg_txt function now takes a target parameter, so all lines like this:

clif_displaymessage(fd, msg_txt(6)); // Your save point has been changed. 
Now look like this:
clif_displaymessage(fd, msg_txt(sd,6)); // Your save point has been changed.
If you have any conflicting code, consider using RegEx to batch update the lines rather than doing so manually; Cydh has explained the process here.

Lastly, the @reloadmsgconf command will reload all message configuration files.

Credits

This project is made possible through the support of many of our members:

Thanks to everyone for their help!

(The original topic may be found here.)

Updates

Please post any updates or changes you would like to see in a translation file here; they will be reviewed and added periodically.

Any time changes are made to the original map_msg files, a post will also be made; if you are contributing to the translations, I ask that you follow this topic and provide updates when this happens.

  • Upvote 7
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

// Message System
460: Please enter a valid language (usage: @langtype <language>).
461: Language is now set to %s.
462: This language is currently disabled.
463: Message configuration has been reloaded.
464: ---- Available languages:

are not in the customs translations

 

 

There are some message in russian translation that doesn't exist in the main msg

// Предметы, привязанные к аккаунту
497: Вы не можете обменивать предмет, привязанный к аккаунту!

// @itembound / @itembound2
498: Нельзя создавать привязанные к аккаунту яйца питомцев или броню.
499: Нельзя создать предмет.
  • Upvote 2
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

/no1

We (I and @nanakiwurtz) will try to keep up-to-date the translation for Bahasa Indonesia

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  407
  • Reputation:   159
  • Joined:  11/18/11
  • Last Seen:  

@Capuche, wow, thanks! 

map_msg_rus.conf is updated.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  182
  • Reputation:   36
  • Joined:  01/26/12
  • Last Seen:  

I've just updated map_msg_es to the latest revision by now.
 
P.S.:
Edited, misread it /hmm

Edited by jaBote
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  2
  • Reputation:   0
  • Joined:  04/12/12
  • Last Seen:  

I've just updated map_msg_es to the latest revision by now.

 

P.S.:

 

clif_displaymessage(fd, msg_txt(6)); // Your save point has been changed. 
Now look like this:
clif_displaymessage(fd, msg_txt(sd,6)); // Your save point has been changed.

 

You forgot to say what was the old way of doing this.

 

Top is old bottom is new... 

Old function doesn't pass " sd " -> msg_txt(6));

New function passes " sd "         -> msg_txt(sd,6));

Edited by Calypso
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  182
  • Reputation:   36
  • Joined:  01/26/12
  • Last Seen:  

LoL, I can swear I knew this but I didn't see the sd on any of the two functions yesterday.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

Why When i use @langtype IDN

 

i got this message "This language is currently Disabled

 

 

how to Enable it ??

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

@melv0 Euphy did a bit paragraph on it did you read ? anyway

in src/common/msg_conf.h

#define LANG_ENABLE 0x00

=> #define LANG_ENABLE 0x20

 

"msg_txt(sd,6));"

New function indeed pass sd (a map_session_data) but if you don't have one available in your function and can cast it, you still can use NULL instead and default langage will be used (English).

"msg_txt(NULL,6));" => will display in English.

Which is still the case for few msg_txt atm.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  402
  • Reputation:   89
  • Joined:  02/07/13
  • Last Seen:  

Is there a way to just enable one language to avoid ram consumption ?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  547
  • Reputation:   270
  • Joined:  11/08/11
  • Last Seen:  

Just set it LANG_ENABLE to 0x00 which is enlish only.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Updated RUS and SPN translations in r17267. Thanks, Lilith and jaBote!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  402
  • Reputation:   89
  • Joined:  02/07/13
  • Last Seen:  

Just set it LANG_ENABLE to 0x00 which is enlish only.

Other than english ^^

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

oke thx shakto i'm sorry i didn't read full :D

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

"Other than english ^^"

It's a bitmask we use that type of configuration on lot of other conf....anyway:

    LANG_RUS = 0x01,
    LANG_SPN = 0x02,
    LANG_GRM = 0x04,
    LANG_CHN = 0x08,
    LANG_MAL = 0x10,
    LANG_IDN = 0x20,
    LANG_FRN = 0x40,
1st) you can't disable english it's extra lang you add by enable them or not. (We could change default english but it's not supported) so here few example of how it work :

#define LANG_ENABLE 0x00 //english only
#define LANG_ENABLE 0x01 //english + russian
#define LANG_ENABLE 0x03 //english + russian + spanish
#define LANG_ENABLE 0x43 //english + russian + spanish + french

#define LANG_ENABLE 0x10 //english + malansian

So basically take LANG_ENABLE and add the value you want enable on it.

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

@mkbu95 added a Brazilian Portuguese (POR) translation in r17268.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  148
  • Reputation:   46
  • Joined:  11/02/11
  • Last Seen:  

What about making these strings translatable?

const char* msg_langtype2langstr(int langtype){
	switch(langtype){
		case 0: return "English (ENG)";
		case 1: return "Russian (RUS)";
		case 2: return "Spanish (SPN)";
		case 3: return "German (GRM)";
		case 4: return "Chinese (CHN)";
		case 5: return "Malasian (MAL)";
		case 6: return "Indonesian (IDN)";
		case 7: return "French (FRN)";
		case 8: return "Brazilian Portuguese (POR)";
		default: return "??";
	}
}
Mainly because of:
461: Language is now set to %s.
If you set your language to french, the text in 461 will be in french but the language name itself will be in english.

I don't have time anymore for this week so if you find that this is a good thing to implement...

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  407
  • Reputation:   159
  • Joined:  11/18/11
  • Last Seen:  

@developers,

as i already said to Lighta, map_msg_rus.conf use wrong encoding (UTF8). in game i recive messages in incorrect encoding + map crush after relogin with langtype = 1. If anyone can upload this file in ANSI encoding, please do it.

Link to map_msg_rus.conf (ANSI).

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

@mkbu95

or just make the the names become language name for each language they call. I mean, the example

case 6: return "Indonesian (IDN)";

become

case 6: return "Bahasa Indonesia (IDN)";

 

and btw, for

case 5: return "Malasian (MAL)";

it should be

case 5: return "Malaysian (MAL)";

need "y" there. :P

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  55
  • Topics Per Day:  0.01
  • Content Count:  216
  • Reputation:   9
  • Joined:  07/12/12
  • Last Seen:  

@mkbu95

or just make the the names become language name for each language they call. I mean, the example

 

case 6: return "Indonesian (IDN)";

become

 

case 6: return "Bahasa Indonesia (IDN)";

 

and btw, for

 

case 5: return "Malasian (MAL)";

it should be

 

case 5: return "Malaysian (MAL)";

need "y" there. :P

 

mantep banget ini.

apa aja nih mas yang udah di tambah ke bahasa indonesia?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  737
  • Reputation:   216
  • Joined:  11/29/11
  • Last Seen:  

Well you don't have map_session_data at this point so you'll need to send it as parameter, but that possible since we don't use that function in many place.

You'll need to take it off msg_conf cause that in common atm and shouldn't know about sd.

Historical reason was that I was tempted to just do return msg_txt(number); cause afterall if we already have the langange you could have skip the switch. but the fallback will break this as well as show the enabled langage. (just in case someone would be tempted)

Malasian is in lighta talk. 

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  182
  • Reputation:   36
  • Joined:  01/26/12
  • Last Seen:  

I don't want to be fussy, but I feel I have to remark that I usually read ESP (from ESPañol: Spanish in Spanish  /heh ) or SPA for denoting the Spanish translation. I've never read SPN for this. But seriously, I'm OK with the SPN.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Some mismatch map_msg <--> map_msg_*

 

rus: [101, 164, 267, 293, 694, 1323]
idn: [172, 173, 253]
chn: [334, 410, 411, 460, 461, 462, 463, 464, 620, 622]

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  153
  • Topics Per Day:  0.04
  • Content Count:  2285
  • Reputation:   745
  • Joined:  06/16/12
  • Last Seen:  

Some mismatch map_msg <--> map_msg_*

 

rus: [101, 164, 267, 293, 694, 1323]

idn: [172, 173, 253]

chn: [334, 410, 411, 460, 461, 462, 463, 464, 620, 622]

not realize that it was changed. /omg

well then, fixed on same link. :D

  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  148
  • Reputation:   46
  • Joined:  11/02/11
  • Last Seen:  

Cydh, good idea on the language thing, maybe I will do that.

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...