* Bug #9295 fixed - 'base2dec' ignored the fractional part of 'base' input argument.
+* Bug #9424 fixed - gettext("") did not return "".
+
* Bug #9502 fixed - 'toolbox' was badly used in assert help pages (replaced by 'module').
* Bug #9572 fixed - assert_checkerror did not check multi lines errors.
* Bug #10579 fixed - Wrong reference to and function in the help page of prod
and cumprod fixed.
+* Bug #10654 fixed - dgettext with "scilab" domain did not return same result
+ than gettext.
+
* Bug #10626 fixed - taucs_chdel(), umf_ludel() returned an error.
* Bug #10631 fixed - The # sign was missing in some error cases.
/*
- * 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-en.txt
- *
- */
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2007 - INRIA - Sylvestre LEDRU
+* Copyright (C) 2012 - DIGITEO - 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-en.txt
+*
+*/
+/*--------------------------------------------------------------------------*/
+#include <string.h>
+#include <stdlib.h>
#include "MALLOC.h"
#include "stack-c.h"
#include "localization.h"
#include "gw_localization.h"
+#include "api_scilab.h"
#include "Scierror.h"
+#include "strsubst.h"
+#ifdef _MSC_VER
+#include "strdup_windows.h"
+#endif
+#include "freeArrayOfString.h"
+/*--------------------------------------------------------------------------*/
+static char *convertString_dgettext(const char *domain, const char *pStr);
/*--------------------------------------------------------------------------*/
int sci_dgettext(char *fname,unsigned long fname_len)
{
- CheckRhs(2,2);
- CheckLhs(1,1);
-
- if ( (GetType(1) == sci_strings) )
- {
- if ( (GetType(2) == sci_strings) )
- {
- static int l1 = 0,n1 = 0,m1 = 0;
- static int l2 = 0,n2 = 0,m2 = 0;
-
- char *domainname = NULL;
- char *msgid = NULL;
- char *TranslatedString = NULL;
-
- GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
- domainname=cstk(l1);
-
- GetRhsVar(2,STRING_DATATYPE,&m2,&n2,&l2);
- msgid=cstk(l2);
- /* We always have something from this functions because dgettext
- * is returning the same string if it cannot find it */
- TranslatedString = dgettext(domainname, msgid);
- n1=1;
- CreateVarFromPtr(Rhs+1,STRING_DATATYPE,(m1=(int)strlen(TranslatedString), &m1),&n1,&TranslatedString);
- LhsVar(1)=Rhs+1;
- PutLhsVar();
- return 0;
- }
- else
- {
- Scierror(999,"%s: Wrong type for input argument #%d: String expected.\n",fname,2);
- return 0;
- }
- }
- else
- {
- Scierror(999,"%s: Wrong type for input argument #%d: String expected.\n",fname,1);
- return 0;
- }
+ SciErr sciErr;
+ int *piAddressVarOne = NULL;
+ int *piAddressVarTwo = NULL;
+
+ CheckRhs(2, 2);
+ CheckLhs(1, 1);
+
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
+ }
+
+ sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddressVarTwo);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 2);
+ }
+
+ if (isStringType(pvApiCtx, piAddressVarOne) && isStringType(pvApiCtx, piAddressVarTwo))
+ {
+ char *domain = NULL;
+
+ if (!isScalar(pvApiCtx, piAddressVarOne))
+ {
+ Scierror(999,"%s: Wrong size for input argument #%d: A string expected.\n", fname, 1);
+ return 0;
+ }
+
+ if (getAllocatedSingleString(pvApiCtx, piAddressVarOne, &domain) == 0)
+ {
+ char **stringsToTranslate = NULL;
+ char **TranslatedStrings = NULL;
+ int m = 0, n = 0;
+ int i = 0;
+
+ if (getAllocatedMatrixOfString(pvApiCtx, piAddressVarTwo, &m, &n, &stringsToTranslate) != 0)
+ {
+ Scierror(999, _("%s: No more memory.\n"), fname);
+ return 0;
+ }
+
+ TranslatedStrings = (char **)MALLOC(sizeof(char*) * (m * n));
+ if (TranslatedStrings == NULL)
+ {
+ freeAllocatedMatrixOfString(m, n, stringsToTranslate);
+ stringsToTranslate = NULL;
+ Scierror(999, _("%s: No more memory.\n"), fname);
+ return 0;
+ }
+
+ for (i = 0; i < m * n; i++)
+ {
+ if (strcmp(stringsToTranslate[i], "") == 0)
+ {
+ TranslatedStrings[i] = strdup("");
+ }
+ else
+ {
+ TranslatedStrings[i] = convertString_dgettext(domain, stringsToTranslate[i]);
+ }
+ }
+
+ freeAllocatedMatrixOfString(m, n, stringsToTranslate);
+ stringsToTranslate = NULL;
+
+ sciErr = createMatrixOfString(pvApiCtx, Rhs + 1, m, n, TranslatedStrings);
+ freeArrayOfString(TranslatedStrings, m * n);
+ TranslatedStrings = NULL;
+
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999,_("%s: Memory allocation error.\n"), fname);
+ return 0;
+ }
+
+ LhsVar(1) = Rhs + 1;
+ PutLhsVar();
+ }
+ else
+ {
+ Scierror(999, _("%s: No more memory.\n"), fname);
+ return 0;
+ }
+ }
+ else
+ {
+ if (isStringType(pvApiCtx, piAddressVarOne))
+ {
+ Scierror(999,"%s: Wrong type for input argument #%d: String expected.\n", fname, 2);
+ }
+ else
+ {
+ Scierror(999,"%s: Wrong type for input argument #%d: String expected.\n", fname, 1);
+ }
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
+static char *convertString_dgettext(const char *domain, const char *pStr)
+{
+ char *pStrConverted = NULL;
+
+ if (pStr)
+ {
+ BOOL revertStrsub = FALSE;
+ char *TranslatedString = NULL;
+ char *tmpStr = NULL;
+ if (strchr(pStr, '\\') != NULL)
+ {
+ char *tmpStr1 = NULL;
+ char *tmpStr2 = NULL;
+ /* There is an \ in the string process to replace */
+
+ /* We always have something from this functions because gettext
+ * is returning the same string if it cannot find it */
+
+ tmpStr1 = strsub((char*)pStr, "\\n", "\n"); /* linefeed */
+ tmpStr2 = strsub(tmpStr1, "\\t", "\t"); /* horizontal tab */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\\r", "\r"); /* carriage return */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ tmpStr2 = strsub(tmpStr1, "\\v", "\v"); /* vertical tab */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\\f", "\f"); /* form feed */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ tmpStr2 = strsub(tmpStr1, "\\\\", "\\"); /* backslash */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\\\"", "\""); /* double quote */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ revertStrsub = TRUE;
+ tmpStr = strdup(tmpStr1);
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+ }
+ else
+ {
+ revertStrsub = FALSE;
+ tmpStr = strdup(pStr);
+ }
+
+ TranslatedString = strdup(dgettext(domain, tmpStr));
+ if (tmpStr)
+ {
+ FREE(tmpStr);
+ tmpStr = NULL;
+ }
+
+ /* Add removed slashes */
+ if (revertStrsub)
+ {
+ char *tmpStr1 = NULL;
+ char *tmpStr2 = NULL;
+
+ tmpStr1 = strsub(TranslatedString, "\\", "\\\\"); /* backslash */
+
+ tmpStr2 = strsub(tmpStr1, "\f", "\\f"); /* form feed */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\n", "\\n"); /* linefeed */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ tmpStr2 = strsub(tmpStr1, "\t", "\\t"); /* horizontal tab */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\r", "\\r"); /* carriage return */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ tmpStr2 = strsub(tmpStr1, "\v", "\\v"); /* vertical tab */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ if (TranslatedString)
+ {
+ FREE(TranslatedString);
+ TranslatedString = NULL;
+ }
+
+ TranslatedString = strdup(tmpStr2);
+
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+ }
+ pStrConverted = TranslatedString;
+ }
+ return pStrConverted;
}
/*--------------------------------------------------------------------------*/
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008 - INRIA - Sylvestre LEDRU
-* Copyright (C) 2009 - DIGITEO - Allan CORNET
+* Copyright (C) 2009-2012 - DIGITEO - 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
#include "stack-c.h"
#include "localization.h"
#include "gw_localization.h"
+#include "api_scilab.h"
#include "Scierror.h"
#include "strsubst.h"
#ifdef _MSC_VER
#include "strdup_windows.h"
#endif
+#include "freeArrayOfString.h"
/*--------------------------------------------------------------------------*/
-int sci_gettext(char *fname,unsigned long fname_len)
+static char *convertString_gettext(const char *pStr);
+/*--------------------------------------------------------------------------*/
+int sci_gettext(char *fname, unsigned long fname_len)
{
- CheckRhs(1,1);
- CheckLhs(1,1);
-
- if ( (GetType(1) == sci_strings) )
- {
- int l1 = 0, n1 = 0, m1 = 0;
- char *tmpStr = NULL;
-
- char *msgid = NULL;
- char *TranslatedString = NULL;
-
- int revertStrsub = FALSE;
-
- GetRhsVar(1,STRING_DATATYPE, &m1, &n1, &l1);
- msgid = cstk(l1);
-
- /* This stupid stuff is necessary because scilab is add slashes
- * and we need to remove them
- * An other solution might be to replace the string "\x" by it
- * real code
- */
- if (strchr(msgid, '\\') != NULL)
- {
- char *tmpStr1 = NULL;
- char *tmpStr2 = NULL;
- /* There is an \ in the string process to replace */
-
- /* We always have something from this functions because gettext
- * is returning the same string if it cannot find it */
-
- tmpStr1 = strsub(msgid, "\\n", "\n"); /* linefeed */
- tmpStr2 = strsub(tmpStr1, "\\t", "\t"); /* horizontal tab */
- if (tmpStr1) {FREE(tmpStr1); tmpStr1 = NULL;}
-
- tmpStr1 = strsub(tmpStr2, "\\r", "\r"); /* carriage return */
- if (tmpStr2) {FREE(tmpStr2); tmpStr2 = NULL;}
-
- tmpStr2 = strsub(tmpStr1, "\\v", "\v"); /* vertical tab */
- if (tmpStr1) {FREE(tmpStr1); tmpStr1 = NULL;}
-
- tmpStr1 = strsub(tmpStr2, "\\f", "\f"); /* form feed */
- if (tmpStr2) {FREE(tmpStr2); tmpStr2 = NULL;}
-
- tmpStr2 = strsub(tmpStr1, "\\\\", "\\"); /* backslash */
- if (tmpStr1) {FREE(tmpStr1); tmpStr1 = NULL;}
-
- tmpStr1 = strsub(tmpStr2, "\\\"", "\""); /* double quote */
- if (tmpStr2) {FREE(tmpStr2); tmpStr2 = NULL;}
-
- revertStrsub = TRUE;
- tmpStr = strdup(tmpStr1);
- if (tmpStr1) {FREE(tmpStr1); tmpStr1 = NULL;}
- }
- else
- {
- revertStrsub = FALSE;
- tmpStr = strdup(msgid);
- }
-
- TranslatedString = strdup(gettext(tmpStr));
- if (tmpStr) {FREE(tmpStr); tmpStr = NULL;}
-
- /* Add removed slashes */
- if (revertStrsub)
- {
- char *tmpStr1 = NULL;
- char *tmpStr2 = NULL;
-
- tmpStr1 = strsub(TranslatedString, "\\", "\\\\"); /* backslash */
-
- tmpStr2 = strsub(tmpStr1, "\f", "\\f"); /* form feed */
- if (tmpStr1) {FREE(tmpStr1); tmpStr1 = NULL;}
-
- tmpStr1 = strsub(tmpStr2, "\n", "\\n"); /* linefeed */
- if (tmpStr2) {FREE(tmpStr2); tmpStr2 = NULL;}
-
- tmpStr2 = strsub(tmpStr1, "\t", "\\t"); /* horizontal tab */
- if (tmpStr1) {FREE(tmpStr1); tmpStr1 = NULL;}
-
- tmpStr1 = strsub(tmpStr2, "\r", "\\r"); /* carriage return */
- if (tmpStr2) {FREE(tmpStr2); tmpStr2 = NULL;}
-
- tmpStr2 = strsub(tmpStr1, "\v", "\\v"); /* vertical tab */
- if (tmpStr1) {FREE(tmpStr1); tmpStr1 = NULL;}
-
- if (TranslatedString) {FREE(TranslatedString); TranslatedString = NULL;}
- TranslatedString = strdup(tmpStr2);
- if (tmpStr2) {FREE(tmpStr2); tmpStr2 = NULL;}
- }
-
- n1 = 1;
- m1 = (int)strlen(TranslatedString);
- CreateVarFromPtr(Rhs + 1, STRING_DATATYPE, &m1, &n1, &TranslatedString);
-
- if (TranslatedString) {FREE(TranslatedString); TranslatedString = NULL;}
-
- LhsVar(1) = Rhs + 1;
- PutLhsVar();
- return 0;
- }
- else
- {
- Scierror(999,_("%s: Wrong type for input argument #%d: String expected.\n"), fname, 1);
- return 0;
- }
+ SciErr sciErr;
+ int *piAddressVarOne = NULL;
+ char **TranslatedStrings = NULL;
+ int m = 0;
+ int n = 0;
+
+ CheckRhs(1, 1);
+ CheckLhs(0, 1);
+
+ sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
+ }
+
+ if (isStringType(pvApiCtx, piAddressVarOne))
+ {
+ char **StringsToTranslate = NULL;
+ int i = 0;
+ if (getAllocatedMatrixOfString(pvApiCtx, piAddressVarOne, &m, &n, &StringsToTranslate) != 0)
+ {
+ Scierror(999, _("%s: No more memory.\n"), fname);
+ return 0;
+ }
+
+ TranslatedStrings = (char **)MALLOC(sizeof(char*) * (m * n));
+ if (TranslatedStrings == NULL)
+ {
+ freeAllocatedMatrixOfString(m, n, StringsToTranslate);
+ StringsToTranslate = NULL;
+ Scierror(999, _("%s: No more memory.\n"), fname);
+ return 0;
+ }
+
+ for (i = 0; i < m * n; i++)
+ {
+ if (strcmp(StringsToTranslate[i], "") == 0)
+ {
+ TranslatedStrings[i] = strdup("");
+ }
+ else
+ {
+ TranslatedStrings[i] = convertString_gettext(StringsToTranslate[i]);
+ }
+ }
+
+ freeAllocatedMatrixOfString(m, n, StringsToTranslate);
+ StringsToTranslate = NULL;
+
+ sciErr = createMatrixOfString(pvApiCtx, Rhs + 1, m, n, TranslatedStrings);
+ freeArrayOfString(TranslatedStrings, m * n);
+ TranslatedStrings = NULL;
+
+ if(sciErr.iErr)
+ {
+ printError(&sciErr, 0);
+ Scierror(999,_("%s: Memory allocation error.\n"), fname);
+ return 0;
+ }
+
+ LhsVar(1) = Rhs + 1;
+ PutLhsVar();
+ }
+ else
+ {
+ Scierror(999,_("%s: Wrong type for input argument #%d: String expected.\n"), fname, 1);
+ }
+ return 0;
+}
+/*--------------------------------------------------------------------------*/
+static char *convertString_gettext(const char *pStr)
+{
+ char *pStrConverted = NULL;
+
+ if (pStr)
+ {
+ BOOL revertStrsub = FALSE;
+ char *TranslatedString = NULL;
+ char *tmpStr = NULL;
+ if (strchr(pStr, '\\') != NULL)
+ {
+ char *tmpStr1 = NULL;
+ char *tmpStr2 = NULL;
+ /* There is an \ in the string process to replace */
+
+ /* We always have something from this functions because gettext
+ * is returning the same string if it cannot find it */
+
+ tmpStr1 = strsub((char*)pStr, "\\n", "\n"); /* linefeed */
+ tmpStr2 = strsub(tmpStr1, "\\t", "\t"); /* horizontal tab */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\\r", "\r"); /* carriage return */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ tmpStr2 = strsub(tmpStr1, "\\v", "\v"); /* vertical tab */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\\f", "\f"); /* form feed */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ tmpStr2 = strsub(tmpStr1, "\\\\", "\\"); /* backslash */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\\\"", "\""); /* double quote */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ revertStrsub = TRUE;
+ tmpStr = strdup(tmpStr1);
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+ }
+ else
+ {
+ revertStrsub = FALSE;
+ tmpStr = strdup(pStr);
+ }
+
+ TranslatedString = strdup(gettext(tmpStr));
+ if (tmpStr)
+ {
+ FREE(tmpStr);
+ tmpStr = NULL;
+ }
+
+ /* Add removed slashes */
+ if (revertStrsub)
+ {
+ char *tmpStr1 = NULL;
+ char *tmpStr2 = NULL;
+
+ tmpStr1 = strsub(TranslatedString, "\\", "\\\\"); /* backslash */
+
+ tmpStr2 = strsub(tmpStr1, "\f", "\\f"); /* form feed */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\n", "\\n"); /* linefeed */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ tmpStr2 = strsub(tmpStr1, "\t", "\\t"); /* horizontal tab */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ tmpStr1 = strsub(tmpStr2, "\r", "\\r"); /* carriage return */
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+
+ tmpStr2 = strsub(tmpStr1, "\v", "\\v"); /* vertical tab */
+ if (tmpStr1)
+ {
+ FREE(tmpStr1);
+ tmpStr1 = NULL;
+ }
+
+ if (TranslatedString)
+ {
+ FREE(TranslatedString);
+ TranslatedString = NULL;
+ }
+
+ TranslatedString = strdup(tmpStr2);
+
+ if (tmpStr2)
+ {
+ FREE(tmpStr2);
+ tmpStr2 = NULL;
+ }
+ }
+ pStrConverted = TranslatedString;
+ }
+ return pStrConverted;
}
/*--------------------------------------------------------------------------*/
checklhs_
checkrhs_
createvar_
- getWarningMode
\ No newline at end of file
+ getWarningMode
+ freeArrayOfString
\ No newline at end of file
<Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
+ <ProjectReference Include="..\..\api_scilab\api_scilab.vcxproj">
+ <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project>
+ </ProjectReference>
<ProjectReference Include="..\..\fileio\fileio.vcxproj">
<Project>{4fc72d4a-80ee-4b1a-8724-0201c1a35621}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 10654 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=10654
+//
+// <-- Short Description -->
+// dgettext with "scilab" domain did not return same result than gettext
+A = dgettext('scilab', '%s: No more memory.\n');
+B = gettext("%s: No more memory.\n");
+assert_checkequal(A, B);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 10654 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=10654
+//
+// <-- Short Description -->
+// dgettext with "scilab" domain did not return same result than gettext
+
+A = dgettext('scilab', '%s: No more memory.\n');
+B = gettext("%s: No more memory.\n");
+assert_checkequal(A, B);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- Non-regression test for bug 9424 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=9424
+//
+// <-- Short Description -->
+// gettext("") did not return ""
+assert_checkequal(gettext(""), "");
+assert_checkequal(dgettext("scilab", ""), "");
+assert_checkequal(dgettext("mydomain", ""), "");
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2012 - DIGITEO - Allan CORNET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- Non-regression test for bug 9424 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=9424
+//
+// <-- Short Description -->
+// gettext("") did not return ""
+
+assert_checkequal(gettext(""), "");
+assert_checkequal(dgettext("scilab", ""), "");
+assert_checkequal(dgettext("mydomain", ""), "");
\ No newline at end of file