Suggestion to scripts in order to help localization

evilpuncker

vai se tratar garota
Messages
2,178
Points
0
Age
109
Location
bronzil
Github
EPuncker
Emulator
Client Version
2019-05-30a MAIN
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
default_biggrin.png


link to related topic

 
Last edited by a moderator:
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,

 
Last edited by a moderator:
@@Dastgir

I don't have a list
default_sad.png
maybe just search for all getitem occurrences?
default_tongue.png


 
@@Haru , can I do this?

(Or the performance will be affected?)

 
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)

Code:
	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:
Code:
	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:
Code:
"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:
Code:
"Quanto";"12 "",""1 ""e 5 "" costano""con uno sconto del 24 %?"
which produces the (broken) sentence:
Code:
	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:
Code:
	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:
Code:
	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:
Code:
"How much do 12 %s, 1 %s and 5 %s cost after a 24%% discount?"
which could be easily translated to:
Code:
"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.
 
Last edited by a moderator:
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
Code:
	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:

Code:
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
 
Last edited by a moderator:
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:

Code:
    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));
 
Last edited by a moderator:
Back
Top