Determining Parameters of the Message Database Files

You can run the following program to determine the current Views display language and the path names where Views looks for the message database files.

You need to set the ILVVERBOSEFINDPATH environment variable (or the verboseFindInPath resource) to true for the path names to be printed out, and you can play with the ILVPATH environment variable to see the effect.

#include <ilviews/ilv.h>

#include <ilviews/base/message.h>

#include <ilog/pathlist.h>

 

int main(int argc, char* argv[])

{

if (!IlvSetLocale()) {

exit(1);

}

 

IlvDisplay* display = new IlvDisplay("CheckLocalizedDbm", 0, argc, argv);

 

IlvPrint("Current Views display language: %s\n",

display->getCurrentLanguage()->name());

 

const char* path = display->getPath();

 

IlPathList plist(path? path : "./");

IlvPrint("Current path: %s\n", plist.getString().getValue());

 

display->getDatabase()->read("my-file.dbm", display);

 

return 0;

}

For example, if you run this program on an HP-UX system where LANG=fr_FR.iso88591 or on a Solaris system where LANG=fr, you will get the following results:

IlvPathList::findInPath file ilviews/locale/fr_FR.ISO-8859-1/views.dbm not in ./.

IlvPathList::findInPath found: <$ILVHOME>/data/ilviews/locale/fr_FR.ISO-8859-1/views.dbm.

 

Current Views display language: fr_FR

 

Current path: ./

 

IlvPathList::findInPath file locale/fr_FR.ISO-8859-1/my-file.dbm not in ./.

IlvPathList::findInPath file locale/fr_FR.ISO-8859-1/my-file.dbm not in <$ILVHOME>/data/.

IlvPathList::findInPath file locale/fr_FR.ISO-8859-1/my-file.dbm not in <$ILVHOME>/data/icon/.

IlvPathList::findInPath file locale/fr_FR.ISO-8859-1/my-file.dbm not in <$ILVHOME>/data/images/.

IlvDisplay::findInPath Couldn’t find ’locale/fr_FR.ISO-8859-1/my-file.dbm’

IlvPathList::findInPath file my-file.dbm not in ./.

IlvPathList::findInPath file my-file.dbm not in <$ILVHOME>/data/.

IlvPathList::findInPath file my-file.dbm not in <$ILVHOME>/data/icon/.

IlvPathList::findInPath file my-file.dbm not in <$ILVHOME>/data/images/.

IlvDisplay::findInPath Couldn’t find ’my-file.dbm’