What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Multilanguage scripts - how to?

Multilanguage scripts - how to?
Author: Message:
ketchup_blade
New Member
*


Posts: 8
Joined: Jul 2005
O.P. Multilanguage scripts - how to?
Hello,

well I got my first script ready, which is really cool (yé!).  However, currently the script is only in english (that's a start).  This is kind of sad, since I also speak french and would like to offer the script on both languages.

In the scripting doc, there is no mention about doing multi-language scripts.  One solution that I thought was to dynamically change the text of the window's labels based on the current user's Messenger language.  However, looking at the doc, I could not find a "Language" property that could let me know which favorite language the user currently have set.

Anyone have a solution, other than recompiling the same script and updating the text in the windows?  I kind of dislike having to maintain two versions of the same code.  Resources files, anyone?

Patchou: how about adding a ".MyLanguage" to the Messenger object?

kb
12-06-2006 03:18 PM
Profile E-Mail PM Find Quote Report
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Multilanguage scripts - how to?
You can check the current MsgPlus language in the registry
[Image: 1-0.png]
             
12-06-2006 03:26 PM
Profile PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Multilanguage scripts - how to?
To make your script multilingual, it takes a lot of work. Screenshot Sender 4 is a good example: it makes an object "Language" which contains arrays for every translation section. So, if you would have a file called "English.ini" with the following content:
code:
[Messages]
Alert=Warning! This script is available in lots of languages!
the script could create an object from the file and then you can get the string with something like this:
code:
Debug.Trace(Language.Messages["Alert"]);

I suggest you to install the SS4 script and take a look at the code. As for static texts which can't be changed using a function, (like a Help attribute) the script has a function which can re-write the interface XML file and replace the content of the elements by the strings from the .ini-file. ;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-06-2006 03:47 PM
Profile E-Mail PM Web Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Multilanguage scripts - how to?
quote:
Originally posted by Ezra
You can check the current MsgPlus language in the registry

HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live\LanguageFile

EDIT: Attached Example Language File. This reads information from the specified file and returns it.

Usage:

read(<language file path>,"Messages","Alert");

would return "Warning! This script is available in lots of languages!" in Mattike's Case.

Use this in:
PlusWnd.SetControlText("<control name>",read(<language file path>,"Messages","Alert"))

.txt File Attachment: Languages.txt (1.4 KB)
This file has been downloaded 140 time(s).

This post was edited on 12-06-2006 at 03:56 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-06-2006 03:50 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Multilanguage scripts - how to?
But in your case, the script would have to read the text file every time it needs a string from the file, which is in most cases a lot. Therefore, it's better to load everything into an object/array and get the strings from there. ;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-06-2006 04:24 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On