diff options
Diffstat (limited to 'modules/localization/includes')
-rwxr-xr-x | modules/localization/includes/InitializeLocalization.h | 21 | ||||
-rwxr-xr-x | modules/localization/includes/TerminateLocalization.h | 18 | ||||
-rwxr-xr-x | modules/localization/includes/charEncoding.h | 88 | ||||
-rwxr-xr-x | modules/localization/includes/dynlib_localization.h | 28 | ||||
-rwxr-xr-x | modules/localization/includes/gw_localization.h | 33 | ||||
-rwxr-xr-x | modules/localization/includes/localization.h | 50 | ||||
-rwxr-xr-x | modules/localization/includes/localizationJava.h | 42 | ||||
-rwxr-xr-x | modules/localization/includes/setgetlanguage.h | 104 |
8 files changed, 384 insertions, 0 deletions
diff --git a/modules/localization/includes/InitializeLocalization.h b/modules/localization/includes/InitializeLocalization.h new file mode 100755 index 000000000..f8fec2094 --- /dev/null +++ b/modules/localization/includes/InitializeLocalization.h @@ -0,0 +1,21 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - Allan CORNET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +#ifndef __INITIALIZELOCALIZATION_H__ +#define __INITIALIZELOCALIZATION_H__ +#include "dynlib_localization.h" +#include "BOOL.h" + +LOCALIZATION_IMPEXP BOOL InitializeLocalization(void); + +#endif /* __INITIALIZELOCALIZATION_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/localization/includes/TerminateLocalization.h b/modules/localization/includes/TerminateLocalization.h new file mode 100755 index 000000000..eb84732c3 --- /dev/null +++ b/modules/localization/includes/TerminateLocalization.h @@ -0,0 +1,18 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - Allan CORNET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ +#ifndef __TERMINATELOCALIZATION_H__ +#define __TERMINATELOCALIZATION_H__ + +BOOL TerminateLocalization(void); + +#endif /* __TERMINATELOCALIZATION_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/localization/includes/charEncoding.h b/modules/localization/includes/charEncoding.h new file mode 100755 index 000000000..03dac7ac3 --- /dev/null +++ b/modules/localization/includes/charEncoding.h @@ -0,0 +1,88 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) INRIA - Allan CORNET +* Copyright (C) 2009 - DIGITEO - Antoine ELIAS , Allan CORNET +* This file must be used under the terms of the CeCILL. +* This source file is licensed as described in the file COPYING, which +* you should have received as part of this distribution. The terms +* are also available at +* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +* +*/ +#ifndef __CHARENCODING_H__ +#define __CHARENCODING_H__ + +#include <wchar.h> +#include <sys/stat.h> +#include <sys/types.h> +#include "MALLOC.h" +#include "BOOL.h" + +#ifdef __cplusplus +extern "C" { +#endif + + /** + * wcfopen macro for fopen Multibyte char multiplatform + * @param[out] fp file descriptor + * @param[in] x filename + * @param[in] y mode + */ + +#ifdef _MSC_VER +#define wcfopen(fp, x,y) \ +{\ + wchar_t* wfilename = NULL;\ + wchar_t* wmode = NULL;\ + wfilename = to_wide_string(x);\ + wmode = to_wide_string(y);\ + if(wfilename == NULL || wmode == NULL){fp = 0;}\ + else {fp = _wfopen(wfilename, wmode);}\ + if(wfilename != NULL){FREE(wfilename);}\ + if(wmode != NULL){FREE(wmode);} \ +} +#else +#define wcfopen(fp, x,y) \ +{\ + fp = fopen(x, y);\ +} +#endif + + /** + * convert a UTF string to wide char string + * @param[in] UTF string + * @return wide char string converted + */ + wchar_t *to_wide_string(const char *_UTFStr); + + /** + * convert a wide char string to UTF-8 + * @param[in] wide char string + * @return UTF string converted + */ + char *wide_string_to_UTF8(const wchar_t *_wide); + + /*file management with UTF filename*/ +#ifdef _MSC_VER + int wcstat(char* filename, struct _stat *st); +#endif + +#ifdef _MSC_VER +#define wcsicmp _wcsicmp +#else + int wcsicmp_others(const wchar_t* s1, const wchar_t* s2); +#define wcsicmp wcsicmp_others +#endif + + /** + * checks input text is a valid UTF-8 format + * @param[in] string to check + * @return TRUE or FALSE + */ + BOOL IsValidUTF8(const char* pStText); + +#ifdef __cplusplus +} +#endif +#endif /* __CHARENCODING_H__ */ + diff --git a/modules/localization/includes/dynlib_localization.h b/modules/localization/includes/dynlib_localization.h new file mode 100755 index 000000000..fe5c0fbc3 --- /dev/null +++ b/modules/localization/includes/dynlib_localization.h @@ -0,0 +1,28 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) DIGITEO - 2009 - Allan CORNET +* +* This file must be used under the terms of the CeCILL. +* This source file is licensed as described in the file COPYING, which +* you should have received as part of this distribution. The terms +* are also available at +* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +* +*/ + +/*--------------------------------------------------------------------------*/ +#ifndef __DYNLIB_LOCALIZATION_H__ +#define __DYNLIB_LOCALIZATION_H__ + +#ifdef _MSC_VER +#ifdef EXPORT_LOCALIZATION_DLL +#define LOCALIZATION_IMPEXP __declspec(dllexport) +#else +#define LOCALIZATION_IMPEXP __declspec(dllimport) +#endif +#else +#define LOCALIZATION_IMPEXP +#endif + +#endif /* __DYNLIB_LOCALIZATION_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/localization/includes/gw_localization.h b/modules/localization/includes/gw_localization.h new file mode 100755 index 000000000..52286fb8a --- /dev/null +++ b/modules/localization/includes/gw_localization.h @@ -0,0 +1,33 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - Allan CORNET + * Copyright (C) 2007-2008 - INRIA - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +#ifndef __GW_LOCALIZATION__ +#define __GW_LOCALIZATION__ +#include "dynlib_localization.h" +/*--------------------------------------------------------------------------*/ +LOCALIZATION_IMPEXP int gw_localization(void); +/*--------------------------------------------------------------------------*/ +/* interface for the previous function Table */ +/*--------------------------------------------------------------------------*/ +LOCALIZATION_IMPEXP int sci_setlanguage(char *fname, unsigned long fname_len); +LOCALIZATION_IMPEXP int sci_getlanguage(char *fname, unsigned long fname_len); +LOCALIZATION_IMPEXP int sci_getdefaultlanguage(char *fname, unsigned long fname_len); +LOCALIZATION_IMPEXP int sci_gettext(char *fname, unsigned long fname_len); +LOCALIZATION_IMPEXP int sci_setdefaultlanguage(char *fname, unsigned long fname_len); +LOCALIZATION_IMPEXP int sci_addlocalizationdomain(char *fname, unsigned long fname_len); + +/*--------------------------------------------------------------------------*/ +#endif /* __GW_LOCALIZATION__ */ +/*--------------------------------------------------------------------------*/ + + diff --git a/modules/localization/includes/localization.h b/modules/localization/includes/localization.h new file mode 100755 index 000000000..b9c5c5814 --- /dev/null +++ b/modules/localization/includes/localization.h @@ -0,0 +1,50 @@ +/* +* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +* Copyright (C) 2007 - INRIA - Sylvestre LEDRU +* +* This file must be used under the terms of the CeCILL. +* This source file is licensed as described in the file COPYING, which +* you should have received as part of this distribution. The terms +* are also available at +* http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +* +*/ +/** +* Declaration of the basic localization methods +*/ +#ifndef __LOCALIZATION_H__ +#define __LOCALIZATION_H__ +/*--------------------------------------------------------------------------*/ +#ifdef __cplusplus +extern "C" { +#endif + +#include "machine.h" /* HAVE_LIBINTL_H */ + +#ifdef HAVE_LIBINTL_H + /* Have been able to find the libintl.h file on the system */ +#include <libintl.h> + + + +#define _(String) gettext(String)/** for console message*/ +#define _d(Domain, String) dgettext(Domain, String) +#define _t(String1,String2,n) ngettext (String1,String2,n) + +#else + /* Restore the normal behaviour ... all the string will be in english */ + +#define _(String) ((const char *) (String)) +#define gettext(String) ((const char *) (String)) +#define dgettext(Domain, String) ((const char *) (String)) +#define _d(Domain, String) ((const char *) (String)) +#define _t(String1,String2,n) ngettext (String1,String2,n) +#define ngettext(String1, String2, n) ((n) == 1 ? (const char *) (String1) : (const char *) (String2)) + +#endif + +#ifdef __cplusplus +} +#endif +#endif /* __LOCALIZATION_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/localization/includes/localizationJava.h b/modules/localization/includes/localizationJava.h new file mode 100755 index 000000000..ac8d5c2db --- /dev/null +++ b/modules/localization/includes/localizationJava.h @@ -0,0 +1,42 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ +/** + * Declaration of the basic localization methods + */ +#ifndef __LOCALIZATIONJAVA_H__ +#define __LOCALIZATIONJAVA_H__ +/*--------------------------------------------------------------------------*/ +#include "machine.h" /* HAVE_LIBINTL_H & NAMELOCALIZATIONDOMAIN*/ + +#ifdef HAVE_LIBINTL_H +/* Have been able to find the libintl.h file on the system */ +#include <libintl.h> +#include "stack-def.h" +/* This piece of code has been written because of the bug #4005 + * in version 5.0, we were using two localization system (native and + * Java). + * Now, only the native one is used. + * However, for an unknown reason, gettext() is not working. Only + * dgettext is */ +#define scigettext(String1) dgettext(NAMELOCALIZATIONDOMAIN,String1) +#define scidgettext(String1, String2) dgettext(String1, String2) + +#else +/* Restore the normal behaviour ... all the string will be in english */ + +#define scigettext(String) ((const char *) (String)) +#define scidgettext(String1, String2) ((const char *) (String2)) + +#endif + +#endif /* __LOCALIZATIONJAVA_H__ */ +/*--------------------------------------------------------------------------*/ diff --git a/modules/localization/includes/setgetlanguage.h b/modules/localization/includes/setgetlanguage.h new file mode 100755 index 000000000..7d09d4ccf --- /dev/null +++ b/modules/localization/includes/setgetlanguage.h @@ -0,0 +1,104 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2007 - INRIA - Sylvestre LEDRU + * Copyright (C) 2007 - INRIA - Allan CORNET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +#ifndef __SETGETLANGUAGE_H__ +#define __SETGETLANGUAGE_H__ + +#include "BOOL.h" + +/** + * change language + * @param lang + */ +BOOL setlanguage(char *lang); + + +/** + * returns current language + * @return + */ +char *getlanguage(void); + +/** + * returns current alias + * example : en_US --> en + * @return + */ +char *getlanguagealias(void); + +/** + * return internal code associated with a language + * @return + */ +int getcurrentlanguagecode(void); + +/** + * returns language of code + * @param code + * @return + */ +char *getlanguagefromcode(int code); + +/** + * get code of a language + * @param language + * @return + */ +int getcodefromlanguage(char *language); + +/** +* try to convert strlanguage (alias) to a good language string +* @param language +* @return +*/ +char *convertlanguagealias(char *strlanguage); + +/** +* test if lang is defined language +* @param lang +* @return TRUE or FALSE +*/ +BOOL LanguageIsOK(char *lang); + +/** + * Check if the current language is the same we are trying to switch to + * + * @param language The language we want to switch to + * @return If we need to change the language or not + */ +BOOL needtochangelanguage(char *language); + + +/** + * Export the locale to the system + * + * @param the locale we want to export + * @return if is worked + */ +BOOL exportLocaleToSystem(char *locale); + +/** + * Set the default language and save it in the registry (Windows) + * @param lang the new language + */ +void setdefaultlanguage(char * lang); + +/** + * Get the default language from the registry (Windows) + * @return the default language + */ +char * getdefaultlanguage(); + + +#endif /* __SETGETLANGUAGE_H__ */ +/*--------------------------------------------------------------------------*/ |