Valhalla Legends Forums Archive | Visual Basic Programming | Language Pack/Locales

AuthorMessageTime
Barabajagal
For quite some time now, I've been working on adding locales to my bot, using an INI-style language pack system to allow modification of all text in the EXE.

The method I'm currently using runs something like this:

.lng file with data such as:
[code][About]
Form=About %PROD%
IconTT=%PROD% ©%YEAR%.
RRIconTT=%CPNY%.
Info1=%PROD%\nVersion %VER%.
Info2=NOTICE:  %TRADE%
License=License
LicenseTT=GNU General Public License.
Hire=Hire the Developer
HireTT=View information about hiring %CPNY%.
OK=OK
OKTT=Close.[/code]

Type variable to hold the strings that are static:
[code]Public Type ABOUTSKIN
  fCaption        As String
  pIconTT        As String
  pRRTT          As String
  lInfo1          As String
  lInfo2          As String
  cLicense        As String
  cLicenseTT      As String
  cHire          As String
  cHireTT        As String
  cOK            As String
  cOKTT          As String
End Type[/code]

Simple system to read the lng file:
[code]  sLang = "About"
  skAbout.fCaption = ReadLang(sLang, "Form")
  skAbout.pIconTT = ReadLang(sLang, "IconTT")
  skAbout.pRRTT = ReadLang(sLang, "RRIconTT")
  skAbout.lInfo1 = ReadLang(sLang, "Info1")
  skAbout.lInfo2 = ReadLang(sLang, "Info2")
  skAbout.cLicense = ReadLang(sLang, "License")
  skAbout.cLicenseTT = ReadLang(sLang, "LicenseTT")
  skAbout.cHire = ReadLang(sLang, "Hire")
  skAbout.cHireTT = ReadLang(sLang, "HireTT")
  skAbout.cOK = ReadLang(sLang, "OK")
  skAbout.cOKTT = ReadLang(sLang, "OKTT")[/code]

This seems to be working alright, aside from being very tedious to switch over, and a few little issues with the more dynamic strings, and things like comparing Battle.net messages to strings (which will be different when a different locale is sent to the server)...

Is there a better way to do all of this?
January 16, 2009, 3:19 AM

Search