Multilingual error messages in EDM
All error messages in EDM are by default in the English language. Error messages in other languages can be "installed" by supplying files with the error messages in the wanted languages. There should be one file for each language. These files should be located at the actual EDM database folder with the naming rules as follows: "EDM.dbName.errtN"
Example: When the database name is "db", the legal error message names would be "EDM.db.errtN" where the "N" in "errtN" is a positive number greater than zero.
As soon as the actual database is recognized during CreateDataBase or OpenDataBase operations, all error message files are loaded into the EDM kernel and are ready to be used. A new configuration variable named EDM_MAIN_ERROR_MESSAGE_LANGUAGE_NUMBER is introduced to define the default error message language, i.e, the error message returned by the edmiGetErrorText function. The default value of the EDM_MAIN_ERROR_MESSAGE_LANGUAGE_NUMBER is zero, meaning the built-in error messages in the English language. A new EDMinterface function edmiGetErrorTextEx with The Following signature:
Â
SdaiString edmiGetErrorTextEx (EdmiError errCode,SdaiInteger errorTextLanguageNumber)
Â
will be implemented to return the error text in the language specified in the errorTextLanguageNumber argument. The value in this argument should be the same number as the "N" in the relevant "EDM.dbName.errtN" file name. When an error text is not found in the actual error text language file, the default English error text is returned from the edmiGetErrorText and the edmiGetErrorTextEx functions. Both the edmiGetErrorText and the edmiGetErrorTextEx return a string in UTF8 encoding. The content in the error text files is a set of UTF8 strings in the following format:
"ErrorNumber = error text" Example: "0 = No error." "1 = Warning: Session is already open." "11000 = ADB and Iterator table is full."
Â
The order of the error messages is insignificant. Leading spaces and spaces before and/or after the equal sign ("=") are skipped.
How set the error message language number in EDOM3 :
long err_mess_language_no = 1; EDMSelect mysel = MyExample.context.getDataFactory().getSelect(); mysel.setInteger(err_mess_language_no); MyExample.context.getServer().getConfiguration().putAttrBN("EDM_MAIN_ERROR_MESSAGE_LANGUAGE_NUMBER", mysel);
Â
How to get a specific error message once the language number has been set and the errno is known :
Â
String myerror = EdmiNativeException.getErrorText(errno);
Â
How to print out the error messages from the EDMSupervisor :
Aux->generate Error Message File
The format of the file is simple and should make use of UTF8 enabled editor to for the language translations.
0 = OK
1 = Warning: Session is already open.
2 = EDMI not available.
3 = Session is not open.
4 = Repository does not exist.
5 = Repository access denied.
6 = Warning: Repository already open.
7 = Repository not open.
8 = Repository access confilict.
9 = Repository access read-write.
10 = Repository access read-only.
11 = Repository access undefined.
12 = Model does not exist.
13 = Model not active.
14 = Model access conflict.
15 = Model access read-write.
16 = Model access read-only.
17 = Model access undefined.
18 = Entity undefined.
19 = Type undefined.
20 = Types not in same schema.
21 = Rule does not exist.
22 = Function not implemented.
23 = Instance does not exist.
24 = Attribute undefined.
25 = Invalid data value type.
26 = Attribute value unset.
27 = Aggregate does not exist.
28 = Iterator does not exist.
29 = Aggregate is empty.
30 = Iterator has no current.
31 = Invalid aggregate type.
32 = Duplicate value in aggregate.
33 = Aggregate index out of bounds.
34 = Function result undefined.
35 = Aggregate index out of bounds.
36 = Underlying system error.
11000 = ADB and Iterator table is full.
11001 = Error in allocating memory for ADB and Iterator identifiers.
11002 = Error in allocating memory for ADB or Iterator.
11003 = Not an ADB id.
11004 = Error in allocating memory for an array.
11005 = Error in allocating data base space for an aggregate.
11006 = Illegal aggregate size type (Fatal internal error).
11007 = Error in allocating memory for aggregate string.
11008 = Error in allocating memory for aggregate ADB.
Etc. etc.
How set the error message language number in EDMSupervisor :
SystemAdm ->Set config parameter