Defining Extensiongetlang() - Casio ClassPad 300 Programming Manual

Sdk programming guide
Hide thumbs Also See for ClassPad 300:
Table of Contents

Advertisement

"Hallo",
"Hallo Mundo",
};
Each supported language in the ClassPad has its own array. You do not have to support
every language if you do not want to.

Defining ExtensionGetLang()

Now comes the step of actually defining the function ExtensionGetLang(). You can
view ExtensionGetLang() in its entirety by looking in HelloLangDatabase.cpp. We will
be looking at the function piece by piece for explanation purposes.
ExtensionGetLang() receives an ID_MESSAGE MessageNo as a parameter. This
parameter should be one of your message IDs. Just to make sure that MessageNo appears
in our enumeration, and to normalize it to be an array index we do the following:
if (MessageNo<HELLO_MESSAGE_START || MessageNo>HELLO_MESSAGE_END)
return "";
MessageNo -= HELLO_MESSAGE_START;
This simply says if MessageNo is not in our enumeration, return "". Otherwise normalize
the message ID to start at 0 so it can function as an index to an array.
The next step that we need to do is determine which array to use to get the language
string. To determine the current language we use the function:
int GetCurrentLanguageInfo()
This function's return value is used in a switch statement of all of the supported
languages:
switch (GetCurrentLanguageInfo())
{
case CurrentLanguage_Deu :
case CurrentLanguage_Esp :
case CurrentLanguage_Fra :
case CurrentLanguage_Por :
case CurrentLanguage_Eng :
default :
pStr = (char *)HelloMessageData_Deu[MessageNo];
break;
pStr = (char *)HelloMessageData_Esp[MessageNo];
break;
pStr = (char *)HelloMessageData_Fra[MessageNo];
break;
pStr = (char *)HelloMessageData_Por[MessageNo];
break;
pStr = (char *)HelloMessageData_Eng[MessageNo];
break;
107

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents