REM ======================================================================================================================= REM === The Access2Base library is a part of the LibreOffice project. === REM === Full documentation is available on http://www.access2base.com === REM ======================================================================================================================= Option Explicit REM ----------------------------------------------------------------------------------------------------------------------- REM --- PRIVATE FUNCTIONS --- REM ----------------------------------------------------------------------------------------------------------------------- Public Function _GetLabel(ByVal psShortlabel As String, Optional ByVal psLocale As String) As String ' Return the localized label corresponding with ShortLabel If IsMissing(psLocale) Then psLocale = UCase(Left(_GetLocale(), 2)) Else psLocale = UCase(psLocale) On Local Error Goto Error_Function If Not Utils._InList(psLocale, Array( _ "EN", "FR" _ )) Then psLocale = "DEFAULT" ' If list incomplete a recursive call will be provided anyway Dim sLocal As String sLocal = psShortLabel Select Case psLocale Case "EN", "DEFAULT" Select Case UCase(psShortlabel) Case "ERR" & ERRDBNOTCONNECTED : sLocal = "No active connection to a database found" Case "ERR" & ERRMISSINGARGUMENTS : sLocal = "Arguments are missing or are not initialized" Case "ERR" & ERRWRONGARGUMENT : sLocal = "Argument nr. %0 [Value = '%1'] is invalid" Case "ERR" & ERRMAINFORM : sLocal = "Document '%0' does not contain any form" Case "ERR" & ERRFORMNOTIDENTIFIED : sLocal = "Form '%0' not identified in database Forms set" Case "ERR" & ERRFORMNOTFOUND : sLocal = "Form '%0' not found" Case "ERR" & ERRFORMNOTOPEN : sLocal = "Form '%0' is currently not open" Case "ERR" & ERRDFUNCTION : sLocal = "DFunction execution failed, SQL=%0" Case "ERR" & ERROPENFORM : sLocal = "Form '%0' could not be opened" Case "ERR" & ERRPROPERTY : sLocal = "Property '%0' not applicable in this context" Case "ERR" & ERRPROPERTYVALUE : sLocal = "Value '%0' is invalid for property '%1'" Case "ERR" & ERRINDEXVALUE : sLocal = "Out of array range or incorrect array size for property '%0'" Case "ERR" & ERRCOLLECTION : sLocal = "Out of array range" Case "ERR" & ERRPROPERTYNOTARRAY : sLocal = "Argument nr.%0 should be an array" Case "ERR" & ERRCONTROLNOTFOUND : sLocal = "Control '%0' not found in parent (form, grid or dialog) '%1'" Case "ERR" & ERRNOACTIVEFORM : sLocal = "No active form or control found" Case "ERR" & ERRDATABASEFORM : sLocal = "Form '%0' has no underlying dataset" Case "ERR" & ERRFOCUSINGRID : sLocal = "Control '%0' not found in gridcontrol '%1'" Case "ERR" & ERRNOGRIDINFORM : sLocal = "No gridcontrol found in form '%0'" Case "ERR" & ERRFINDRECORD : sLocal = "FindNext() must be preceded by a successful FindRecord(...) call" Case "ERR" & ERRSQLSTATEMENT : sLocal = "SQL Error, SQL statement = '%0'" Case "ERR" & ERROBJECTNOTFOUND : sLocal = "%0 '%1' not found" Case "ERR" & ERROPENOBJECT : sLocal = "%0 '%1' could not be opened" Case "ERR" & ERRCLOSEOBJECT : sLocal = "%0 '%1' could not be closed" Case "ERR" & ERRACTION : sLocal = "Action not applicable in this context" Case "ERR" & ERRSENDMAIL : sLocal = "Mail service could not be activated" Case "ERR" & ERRFORMYETOPEN : sLocal = "Form %0 is already open" Case "ERR" & ERRMETHOD : sLocal = "Method '%0' not applicable in this context" Case "ERR" & ERRPROPERTYINIT : sLocal = "Property '%0' applicable but not initialized" Case "ERR" & ERRFILENOTCREATED : sLocal = "File '%0' could not be created" Case "ERR" & ERRDIALOGNOTFOUND : sLocal = "Dialog '%0' not found in the currently loaded libraries" Case "ERR" & ERRDIALOGUNDEFINED : sLocal = "Dialog unknown" Case "ERR" & ERRDIALOGSTARTED : sLocal = "Dialog already started" Case "ERR" & ERRDIALOGNOTSTARTED : sLocal = "Dialog '%0' not active" Case "ERR" & ERRRECORDSETNODATA : sLocal = "Recordset delivered no data. Action on current record rejected" Case "ERR" & ERRRECORDSETCLOSED : sLocal = "Recordset has been closed. Recordset action rejected" Case "ERR" & ERRRECORDSETRANGE : sLocal = "Current record out of range" Case "ERR" & ERRRECORDSETFORWARD : sLocal = "Action rejected in a forward-only or not bookmarkable recordset" Case "ERR" & ERRFIELDNULL : sLocal = "Field is null or empty. Action rejected" Case "ERR" & ERRFILEACCESS : sLocal = "File access error on file '%0'" Case "ERR" & ERRMEMOLENGTH : sLocal = "Field length (%0) exceeds maximum length. Use WriteAllText instead" Case "ERR" & ERRNOTACTIONQUERY : sLocal = "Query '%0' is not an action query" Case "ERR" & ERRNOTUPDATABLE : sLocal = "Database, recordset or field is read only" Case "ERR" & ERRUPDATESEQUENCE : sLocal = "Recordset update sequence error" Case "ERR" & ERRNOTNULLABLE : sLocal = "Field '%0' must not contain a NULL value" Case "ERR" & ERRROWDELETED : sLocal = "Current row has been deleted by another process or user" Case "ERR" & ERRRECORDSETCLONE : sLocal = "Cloning a cloned Recordset is forbidden" Case "ERR" & ERRQUERYDEFDELETED : sLocal = "Pre-existing query '%0' has been deleted" Case "ERR" & ERRTABLEDEFDELETED : sLocal = "Pre-existing table '%0' has been deleted" Case "ERR" & ERRTABLECREATION : sLocal = "Table '%0' could not be created" Case "ERR" & ERRFIELDCREATION : sLocal = "Field '%0' could not be created" '---------------------------------------------------------------------------------------------------------------------- Case "OBJECT" : sLocal = "Object" Case "TABLE" : sLocal = "Table" Case "QUERY" : slocal = "Query" Case "FORM" : sLocal = "Form" Case "REPORT" : sLocal = "Report" Case "RECORDSET" : sLocal = "Recordset" Case "FIELD" : sLocal = "Field" Case "TEMPVAR" : sLocal = "Temporary variable" '---------------------------------------------------------------------------------------------------------------------- Case "ERR#" : sLocal = "Error #" Case "ERROCCUR" : sLocal = "occurred" Case "ERRLINE" : sLocal = "at line" Case "ERRIN" : sLocal = "in" Case "CALLTO" : sLocal = "a call to function" Case "SAVECONSOLE" : sLocal = "Save console" Case "SAVECONSOLEENTRIES" : sLocal = "The console entries have been saved successfully." Case "QUITSHORT" : sLocal = "Quit" Case "QUIT" : sLocal = "Do you really want to quit the application ? Changed data will be saved." Case "ENTERING" : sLocal = "Entering" Case "EXITING" : sLocal = "Exiting" '---------------------------------------------------------------------------------------------------------------------- Case "DLGTRACE_HELP" : sLocal = "Manage the console buffer and its entries" Case "DLGTRACE_TITLE" : sLocal = "Console" Case "DLGTRACE_LBLENTRIES_HELP" : sLocal = "Clear the list and resize the circular buffer" Case "DLGTRACE_LBLENTRIES_LABEL" : sLocal = "Set max number of entries" Case "DLGTRACE_TXTTRACELOG_HELP" : sLocal = "Text can be selected, copied, ..." Case "DLGTRACE_TXTTRACELOG_TEXT" : sLocal = "--- Log file is empty ---" Case "DLGTRACE_CMDCANCEL_HELP" : sLocal = "Cancel and close the dialog" Case "DLGTRACE_CMDCANCEL_LABEL" : sLocal = "Cancel" Case "DLGTRACE_LBLCLEAR_HELP" : sLocal = "Clear the list" Case "DLGTRACE_LBLCLEAR_LABEL" : sLocal = "Clear the list" Case "DLGTRACE_LBLMINLEVEL_HELP" : sLocal = "Register only logging requests above given level" Case "DLGTRACE_LBLMINLEVEL_LABEL" : sLocal = "Set minimal trace level" Case "DLGTRACE_CMDOK_HELP" : sLocal = "Validate" Case "DLGTRACE_CMDOK_LABEL" : sLocal = "OK" Case "DLGTRACE_CMDDUMP_HELP" : sLocal = "Choose a file and dump the actual list content in it" Case "DLGTRACE_CMDDUMP_LABEL" : sLocal = "Dump to file" Case "DLGTRACE_LBLNBENTRIES_HELP" : sLocal = "Actual size of list" Case "DLGTRACE_LBLNBENTRIES_LABEL" : sLocal = "Actual number of entries:" '---------------------------------------------------------------------------------------------------------------------- Case "DLGFORMAT_HELP" : sLocal = "Export the form" Case "DLGFORMAT_TITLE" : sLocal = "OutputTo" Case "DLGFORMAT_LBLFORMAT_HELP" : sLocal = "Format in which the form should be exported" Case "DLGFORMAT_LBLFORMAT_LABEL" : sLocal = "Select the output format" Case "DLGFORMAT_CMDOK_HELP" : sLocal = "Validate your choice" Case "DLGFORMAT_CMDOK_LABEL" : sLocal = "OK" Case "DLGFORMAT_CMDCANCEL_HELP" : sLocal = "Cancel and close the dialog" Case "DLGFORMAT_CMDCANCEL_LABEL" : sLocal = "Cancel" '---------------------------------------------------------------------------------------------------------------------- Case Else : sLocal = "" End Select Case "FR" Select Case UCase(psShortlabel) Case "ERR" & ERRDBNOTCONNECTED : sLocal = "Pas de connexion active trouvée à une banque de données" Case "ERR" & ERRMISSINGARGUMENTS : sLocal = "Des arguments sont manquants ou non initialisés" Case "ERR" & ERRWRONGARGUMENT : sLocal = "L'argument n° %0 [Valeur = '%1'] n'est pas valable" Case "ERR" & ERRMAINFORM : sLocal = "Le document '%0' ne contient aucun formulaire" Case "ERR" & ERRFORMNOTIDENTIFIED : sLocal = "Le formulaire '%0' n'a pas pu être identifié parmi l'ensemble des formulaires de la Database" Case "ERR" & ERRFORMNOTFOUND : sLocal = "Formulaire '%0' non trouvé" Case "ERR" & ERRFORMNOTOPEN : sLocal = "Le formulaire '%0' n'est actuellement pas ouvert" Case "ERR" & ERRDFUNCTION : sLocal = "L'exécution de la ""fonction database"" a échoué, SQL=%0" Case "ERR" & ERROPENFORM : sLocal = "Le formulaire '%0' n'a pas pu être ouvert" Case "ERR" & ERRPROPERTY : sLocal = "La propriété '%0' n'est pas applicable dans ce contexte" Case "ERR" & ERRPROPERTYVALUE : sLocal = "La valeur '%0' est invalide pour la propriété '%1'" Case "ERR" & ERRINDEXVALUE : sLocal = "Indice invalide ou dimension erronée du tableau pour la propriété '%0'" Case "ERR" & ERRCOLLECTION : sLocal = "Indice de tableau invalide" Case "ERR" & ERRPROPERTYNOTARRAY : sLocal = "L'argument n°%0 doit être un tableau" Case "ERR" & ERRCONTROLNOTFOUND : sLocal = "Contrôle '%0' non trouvé dans le parent (formulaire ou contrôle de table) '%1'" Case "ERR" & ERRNOACTIVEFORM : sLocal = "Pas de formulaire ou de contrôle actif" Case "ERR" & ERRDATABASEFORM : sLocal = "Le formulaire '%0' n'a pas de données sous-jacentes" Case "ERR" & ERRFOCUSINGRID : sLocal = "Contrôle '%0' non trouvé dans le contrôle de table '%1'" Case "ERR" & ERRNOGRIDINFORM : sLocal = "Aucun contrôle de table trouvé dans le formulaire '%0'" Case "ERR" & ERRFINDRECORD : sLocal = "FindNext() doit être précédé par un appel réussi à FindRecord(...)" Case "ERR" & ERRSQLSTATEMENT : sLocal = "Erreur SQL, instruction SQL = '%0'" Case "ERR" & ERROBJECTNOTFOUND : sLocal = "%0 '%1' non trouvé(e)" Case "ERR" & ERROPENOBJECT : sLocal = "%0 '%1': ouverture en échec" Case "ERR" & ERRCLOSEOBJECT : sLocal = "%0 '%1': fermeture en échec" Case "ERR" & ERRACTION : sLocal = "Action non applicable dans ce contexte" Case "ERR" & ERRSENDMAIL : sLocal = "Le service de messagerie n'a pas pu être activé" Case "ERR" & ERRFORMYETOPEN : sLocal = "Le formulaire %0 est déjà ouvert" Case "ERR" & ERRMETHOD : sLocal = "La méthode '%0' n'est pas applicable dans ce contexte" Case "ERR" & ERRPROPERTYINIT : sLocal = "Propriété '%0' applicable mais non initialisée" Case "ERR" & ERRFILENOTCREATED : sLocal = "Erreur de création du fichier '%0'" Case "ERR" & ERRDIALOGNOTFOUND : sLocal = "Dialogue '%0' introuvable dans les librairies chargées actuellement" Case "ERR" & ERRDIALOGUNDEFINED : sLocal = "Boîte de dialogue inconnue" Case "ERR" & ERRDIALOGSTARTED : sLocal = "Dialogue déjà initialisé précédemment" Case "ERR" & ERRDIALOGNOTSTARTED : sLocal = "Dialogue '%0' non initialisé" Case "ERR" & ERRRECORDSETNODATA : sLocal = "Recordset n'a pas fourni de données. Toute action sur les enregistrements est rejetée" Case "ERR" & ERRRECORDSETCLOSED : sLocal = "Recordset a été clôturé. Action sur l'enregistrement courant est rejetée" Case "ERR" & ERRRECORDSETRANGE : sLocal = "L'enregistrement courant est hors cadre" Case "ERR" & ERRRECORDSETFORWARD : sLocal = "Action rejetée car recordset lisible seulement vers l'avant ou n'acceptant pas de signets" Case "ERR" & ERRFIELDNULL : sLocal = "Champ nul ou vide. Action rejetée" Case "ERR" & ERRFILEACCESS : sLocal = "Erreur d'accès au fichier '%0'" Case "ERR" & ERRMEMOLENGTH : sLocal = "La longueur du champ (%0) dépasse la taille maximale autorisée.. Remplacer par WriteAllText" Case "ERR" & ERRNOTACTIONQUERY : sLocal = "La requête '%0' n'est pas une requête d'action" Case "ERR" & ERRNOTUPDATABLE : sLocal = "La banque de données, le recordset ou le champ sont en lecture seulement" Case "ERR" & ERRUPDATESEQUENCE : sLocal = "Erreur de séquence lors de la mise à jour d'un Recordset" Case "ERR" & ERRNOTNULLABLE : sLocal = "Le champ '%0' ne peut pas recevoir une valeur NULLe" Case "ERR" & ERRROWDELETED : sLocal = "L'enregistrement courant a été effacé par un autre processus ou un autre utilisateur" Case "ERR" & ERRRECORDSETCLONE : sLocal = "Le clonage d'un Recordset cloné est interdit" Case "ERR" & ERRQUERYDEFDELETED : sLocal = "La requête existante '%0' a été supprimée" Case "ERR" & ERRTABLEDEFDELETED : sLocal = "La table existante '%0' a été supprimée" Case "ERR" & ERRTABLECREATION : sLocal = "La table '%0' n'a pas pu être créée" Case "ERR" & ERRFIELDCREATION : sLocal = "Le champ '%0' n'a pas pu être créé" '---------------------------------------------------------------------------------------------------------------------- Case "OBJECT" : sLocal = "Objet" Case "TABLE" : sLocal = "Table" Case "QUERY" : slocal = "Requête" Case "FORM" : sLocal = "Formulaire" Case "REPORT" : sLocal = "Rapport" Case "RECORDSET" : sLocal = "Recordset" Case "FIELD" : sLocal = "Champ" Case "TEMPVAR" : sLocal = "Variable temporaire" '---------------------------------------------------------------------------------------------------------------------- Case "ERR#" : sLocal = "L'erreur #" Case "ERROCCUR" : sLocal = "s'est produite" Case "ERRLINE" : sLocal = "à la ligne" Case "ERRIN" : sLocal = "dans" Case "CALLTO" : sLocal = "un appel à la fonction" Case "SAVECONSOLE" : sLocal = "Sauver console" Case "SAVECONSOLEENTRIES" : sLocal = "Les entrées de la console ont été sauvées avec succès." Case "QUITSHORT" : sLocal = "Quitter" Case "QUIT" : sLocal = "Voulez-vous réellement quitter l'application ? Les données modifiées seront sauvées." Case "ENTERING" : sLocal = "Entrée dans" Case "EXITING" : sLocal = "Sortie de" '---------------------------------------------------------------------------------------------------------------------- Case "DLGTRACE_HELP" : sLocal = "Gestion du tampon de la console et toutes ses entrées" Case "DLGTRACE_TITLE" : sLocal = "Console" Case "DLGTRACE_LBLENTRIES_HELP" : sLocal = "Effacer la liste et redimensionner le tampon circulaire" Case "DLGTRACE_LBLENTRIES_LABEL" : sLocal = "Définir le nombre maximum d'entrées" Case "DLGTRACE_TXTTRACELOG_HELP" : sLocal = "Le texte peut être sélectionné, copié, ..." Case "DLGTRACE_TXTTRACELOG_TEXT" : sLocal = "--- Le fichier journal est vide ---" Case "DLGTRACE_CMDCANCEL_HELP" : sLocal = "Annuler et fermer la boîte de dialogue" Case "DLGTRACE_CMDCANCEL_LABEL" : sLocal = "Annuler" Case "DLGTRACE_LBLCLEAR_HELP" : sLocal = "Effacer la liste" Case "DLGTRACE_LBLCLEAR_LABEL" : sLocal = "Effacer la liste" Case "DLGTRACE_LBLMINLEVEL_HELP" : sLocal = "N'enregistrer que les demandes de journalisation à partir du niveau indiqué" Case "DLGTRACE_LBLMINLEVEL_LABEL" : sLocal = "Définir le niveau minimal d'enregistrement" Case "DLGTRACE_CMDOK_HELP" : sLocal = "Valider" Case "DLGTRACE_CMDOK_LABEL" : sLocal = "OK" Case "DLGTRACE_CMDDUMP_HELP" : sLocal = "Sélectionner un fichier et y vider le contenu actuel des traces enregistrées" Case "DLGTRACE_CMDDUMP_LABEL" : sLocal = "Vider dans fichier" Case "DLGTRACE_LBLNBENTRIES_HELP" : sLocal = "Taille actuelle de la liste" Case "DLGTRACE_LBLNBENTRIES_LABEL" : sLocal = "Nombre actuel d'entrées:" '---------------------------------------------------------------------------------------------------------------------- Case "DLGFORMAT_HELP" : sLocal = "Exporter le formulaire" Case "DLGFORMAT_TITLE" : sLocal = "OutputTo" Case "DLGFORMAT_LBLFORMAT_HELP" : sLocal = "Format dans lequel le formulaire sera exporté" Case "DLGFORMAT_LBLFORMAT_LABEL" : sLocal = "Selectionner le format de sortie" Case "DLGFORMAT_CMDOK_HELP" : sLocal = "Valider votre choix" Case "DLGFORMAT_CMDOK_LABEL" : sLocal = "OK" Case "DLGFORMAT_CMDCANCEL_HELP" : sLocal = "Annuler et fermer la boîte de dialogue" Case "DLGFORMAT_CMDCANCEL_LABEL" : sLocal = "Annuler" '---------------------------------------------------------------------------------------------------------------------- Case Else : sLocal = _Getlabel(psShortLabel, "DEFAULT") End Select REM ******************************************************************************************************************************************* REM *** *** REM *** ANY OTHER LANGUAGE TO BE INSERTED HERE *** REM *** *** REM ******************************************************************************************************************************************* Case Else sLocal = _Getlabel(psShortLabel, "DEFAULT") End Select Exit_Function: _Getlabel = sLocal Exit Function Error_Function: sLocal = psShortLabel GoTo Exit_Function End Function ' GetLabel V0.8.9 REM ----------------------------------------------------------------------------------------------------------------------- Public Function _GetLabelArray(ByVal pvShortlabel As Variant, Optional ByVal psLocale As String) As Variant ' Return the localized label corresponding with the ShortLabel array of strings If IsMissing(psLocale) Then psLocale = UCase(Left(_GetLocale(), 2)) Else psLocale = UCase(psLocale) On Local Error Goto Error_Function Dim vLocal() As Variant, i As integer vLocal = Array() If Not IsArray(pvShortLabel) Then vLocal = _GetLabel(pvShortLabel, psLocale) Goto Exit_Function End If ReDim vLocal(LBound(pvShortLabel) To UBound(pvShortlabel)) For i = LBound(pvShortLabel) To UBound(pvShortlabel) vLocal(i) = _GetLabel(pvShortLabel(i), psLocale) Next i Exit_Function: _GetlabelArray = vLocal() Exit Function Error_Function: vLocal = Array() GoTo Exit_Function End Function ' GetLabelArray V0.8.9 REM ----------------------------------------------------------------------------------------------------------------------- Public Function _GetLocale() as String 'Return OO localization 'Derived from Tools library Dim oLocale as Object oLocale = _GetRegistryKeyContent("org.openoffice.Setup/L10N") _GetLocale = oLocale.getByName("ooLocale") End Function ' GetLocale V0.8.9