Jump to content
evilpuncker

Suggestion to scripts in order to help localization

Recommended Posts

My suggestion is to change all item names in script into getitemname(ID) so we can just translate our item_db instead of the need of search each item name in db each time we are translating a npc file

 

more suggestions:

 

- make we able to translate announce/message/dispbottom/etc messages as well

- make we able to translate NPC names

- make we able to translate mob names (in spawn file)

 

@@Ind @@Haru :D

 

 

link to related topic

Edited by evilpuncker

Share this post


Link to post
Share on other sites

My suggestion is to change all item names in script into getitemname(ID) so we can just translate our item_db instead of the need of search each item name in db each time we are translating a npc file

Good, I am with it, but can you list all NPCs?(here or pm me)

I can recall some NPCs like wolchev and like that, but I can't recall old NPCs using item names,

Share this post


Link to post
Share on other sites

Sure, I don't mind.

 

The problem with this is that different languages will have different sentence order, so if we want it to be easily translatable, we can't really split sentences with a +, like we've been doing so far.

 

For example, given the following sentence (npc/jobs/2-2/alchemist.txt:565)

	mes "How much do";	mes "12 Red Potions,";	mes "1 Butterfly Wing";	mes "and 5 Fly Wings cost";	mes "after a 24 % discount?";
If we change it to:
	mes "How much do";	mes "12 " + getitemname(Red_Potion) + ",";	mes "1 " + getitemname(Wing_Of_Butterfly);	mes "and 5 "+ getitemname(Wing_Of_Fly) + " cost";	mes "after a 24 % discount?";
then it would generate the strings:
"How much do";"12 "",""1 ""and 5 "" cost""after a 24 % discount?"
Translating them individually to another language (for example, Italian), would get you this:
"Quanto";"12 "",""1 ""e 5 "" costano""con uno sconto del 24 %?"
which produces the (broken) sentence:
	mes "Quanto";	mes "12 " + getitemname(Red_Potion) + ",";	mes "1 " + getitemname(Wing_Of_Butterfly);	mes "e 5 "+ getitemname(Wing_Of_Fly) + " costano";	mes "con uno sconto del 24 %?";
while the correct sentence should look like:
	mes "Quanto vengono a costare";	mes "12 " + getitemname(Red_Potion) + ",";	mes "1 " + getitemname(Wing_Of_Butterfly);	mes "e 5 "+ getitemname(Wing_Of_Fly);	mes "con uno sconto del 24 %?";
This would be easily translatable if the sentence was written in this form:
	mes sprintf(_("How much do 12 %s, 1 %s and 5 %s cost after a 24%% discount?"),		getitemname(Red_Potion),		getitemname(Wing_Of_Butterfly),		getitemname(Wing_Of_Fly));
because it'd produce just one translatable sentence:
"How much do 12 %s, 1 %s and 5 %s cost after a 24%% discount?"
which could be easily translated to:
"Quanto vengono a costare 12 %s, 1 %s e 5 %s con uno sconto del 24%%?"
Edit: even better would be to implement positional tokens (%1, %2, %3, etc) instead of "dumb" %s. In some cases it might be necessary to reorder the translated elements in a way that can't be achieved with a simple %s. But as a beginning, a simple sprintf would be enough.

Share this post


Link to post
Share on other sites

use sprintf

I already did that on some of my script

https://drive.google.com/file/d/0B2BM920mmHQgeElaSG5XakNqNVU/view

.

.

	mes "How much do";	mes "12 Red Potions,";	mes "1 Butterfly Wing";	mes "and 5 Fly Wings cost";	mes "after a 24 % discount?";
into
	mes "How much do";	mes sprintf("12 %s,", getitemname(Red_Potion));	mes sprintf("1 %s", getitemname(Wing_Of_Butterfly));	mes sprintf("and 5 %s cost", getitemname(Wing_Of_Fly));	mes "after a 24 % discount?";
.

.

EDIT: and our clif->message all uses sprintf isn't it =/

 

EDIT2:

we are missing some text manipulation like rathena has

https://github.com/rathena/rathena/blob/master/npc/other/Global_Functions.txt#L429

 

EDIT3:

prontera,155,185,5	script	kjdhsfsjhf	1_F_MARIA,{	mes sprintf(_("How much dor"		"12 %s,r"		"1 %sr"		"and 5 %s costr"		"after a 24 %% discount?"),		getitemname(Red_Potion),		getitemname(Wing_Of_Butterfly),		getitemname(Wing_Of_Fly));	close;}
credit to Haru for finding out r can do line break in mes Edited by AnnieRuru

Share this post


Link to post
Share on other sites

That way won't really solve it though. It needs to be collapsed into one string (in languages like Italian, the sentence order is different, so you can't keep the "how much do" and the "cost" parts separate, but you need to reorder them - see my sprintf example above

 

 

This is a proof of concept of what the NPC scripts would look like with this change (I only did the Parmy Gianino NPC): https://gist.github.com/MishimaHaruna/4b0e735d8f6fffb005ad

 

 

 

---

 

 

Okay, since AnnieRuru brought up a good argument in favor of hard-wrapping strings in some languages (specifically, Eastern Asian languages), I went and tested a bit, and it turns out that the client understands the r character:

 

See image:

 

 

Image%202015-12-31%20at%2001.56.20.png

 

 

 

That allows us to use sprintf this way:

    mes sprintf(_("How much dor"        "12 %s,r"        "1 %sr"        "and 5 %s costr"        "after a 24 %% discount?"),        getitemname(Red_Potion),        getitemname(Wing_Of_Butterfly),        getitemname(Wing_Of_Fly));

Share this post


Link to post
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.   Restore formatting

  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.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.