Legacy GM [SOLVED] Text and language issue

Fabseven

Member
Hello
I am wondering if there are Antoine simple fonction un GM to mâle gammes multi language FR EN DE en so on ?

Or should i use à script like _text( lang_id, text_id) with à switch inside ? (Or à database ?)

Same question with text formation , i didnt saw à function to justify text and make it un à good size tout go I à Given rectangle/Windows

Ex : string "azerrtyyuhgdsdghhhbgxsqqergggfddffhjjklmlhytg"
Is not fine in my rectangle because it goes off(only 200 width) do I have to put # inside for new Line.
 

sp202

Member
What happened to your keyboard?

Anyway, what you can do is store lines in variables and have those variables read from external files on startup such that each language has a separate file. Also, I'm sure there are scripts out there for justifying text (pretty sure they involve running through the string and adding new line characters).
 

PNelly

Member
Hello
I am wondering if there are Antoine simple fonction un GM to mâle gammes multi language FR EN DE en so on ?

Or should i use à script like _text( lang_id, text_id) with à switch inside ? (Or à database ?)

Same question with text formation , i didnt saw à function to justify text and make it un à good size tout go I à Given rectangle/Windows

Ex : string "azerrtyyuhgdsdghhhbgxsqqergggfddffhjjklmlhytg"
Is not fine in my rectangle because it goes off(only 200 width) do I have to put # inside for new Line.
Multi language functionality you have to build yourself but it isn't very hard. You just need a data structure of your choice to hold all of the different strings and a consistent way of accessing them. Previously I've used a different ds_map for each language, with custom macros that mapped the strings out. Worked nicely because you could define behavior for every language at the same time.

Short example:
Code:
// define language strings
english = ds_map_create();
ds_map_add(english, INTRO, "Welcome");
german = ds_map_create();
ds_map_add(german, INTRO, "Welkommen");

global.language = german;

// an object's text
message = ds_map_find_value(global.language, INTRO);

draw_text(x,y,message);
There's nothing built in for drawing justified text. It could certainly be done, but it would be it's own project. You'd have to determine the number of words that fit on a line of text, find the amount of white space between the words, then evenly allocate the space to each word on the line. That would mean parsing all of your text into words, calculating their sizes, then running an algorithm to determine the resulting text, line by line.
 

Llama_Code

Member
It does not have a built in justify function, but this can help you with the word wrap,

http://www.gmlscripts.com/script/string_wordwrap_width

That will automatically wrap your lines in a give pixel amount. It won't be justified, but you wound have to manually insert line breaks.

For the language, your best solution would to be to make language files as text files and load the appropriate one. There is not a built in way to handle different languages.
 

Fabseven

Member
TY all ,
so use a ds map and use file to store values. May be simple, going to check for your script Llama too, ty again.
 
Top