Shoutbox

Multilanguage scripts - how to? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Multilanguage scripts - how to? (/showthread.php?tid=69208)

Multilanguage scripts - how to? by ketchup_blade on 12-06-2006 at 03:18 PM

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


RE: Multilanguage scripts - how to? by Ezra on 12-06-2006 at 03:26 PM

You can check the current MsgPlus language in the registry


RE: Multilanguage scripts - how to? by Matti on 12-06-2006 at 03:47 PM

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. ;)
RE: Multilanguage scripts - how to? by Spunky on 12-06-2006 at 03:50 PM

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"))

RE: Multilanguage scripts - how to? by Matti on 12-06-2006 at 04:24 PM

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. ;)