ENGLISH:
Hey Guys, maybe you thought about a multilingual support for your game or application. Here is a solution which uses the standard windows language as default! So you don't need to create any language settings. This system uses the windows API functions, so you need to include windows.h
You need a resource editor to create your strings, but is is really useful to store many strings which should be localized.
GERMAN:
Hey Leute, nochmal ein neues Snippet von mir. Diesmal geht es um multilinguale Spiele und Anwendungen. Dieses Snippet hier nimmt die Strings aus einer DLL und verwendet gegebenenfalls die Systemsprache für euere Anwendung. Wenn ihr also euere Anwendung in Deutsch und Englisch vertreiben wollt, müsst ihr nichtmal ein Sprachsetting machen, das System übernimmt einfach die passende Sprache in euerer Anwendung.
Man benötigt einen Ressourcen-Editor, um eine solche Datei zu erstellen, aber es gibt sehr viele davon.
CODE:
#include <acknex.h>
#include <default.c>
#include <windows.h>
char tmpString[256]; //define the string
function main()
{
HINSTANCE instance = LoadLibrary("stringTable.dll"); //Need to load the library in memory
if(instance)
{
HMODULE mod = GetModuleHandle("stringTable.dll"); //You need the module handle to get strings
if(mod)
{
int length = LoadString(
mod, //the module handle
0, //string id from table
tmpString, //pointer to char array
256 //The max. string length
);
error(tmpString); //print the string
}
else
{
error("Module not found!"); //print error message
}
}
else
{
error("Library not found!");
}
}
This example uses a library called stringTable.dll
You can get this
hereDieses beispiel benutzt eine Bibliothek names stringTable.dll
Sie kann
hier heruntergeladen werden.
String Tables:
You have to create string tables in the library with an resource editor. If you don't know how, read the manual of your resource editor or ask me
Man benötigt String Tables in der Bibliothek. Diese erstellt man mit einem Resourcen-Editor. Wenn man nicht weiß wie, einfach im Handbuch des Resourceneditor nachschauen oder mich fragen.
Resource Editor:
ResEdit