Fix error message and update localization script
[scilab.git] / scilab / modules / helptools / macros / help.sci
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2008 - INRIA - Vincent COUVERT
3 //
4 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution.  The terms
7 // are also available at
8 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
9
10 function help(varargin)
11
12     [lhs,rhs]=argn(0);
13
14     if rhs >= 1 then
15         key = varargin(1);
16     else
17         key = "";
18     end
19
20     if (findfiles("SCI/modules/helptools/jar","*_help.jar") <> []) then
21
22         if getscilabmode() <> "NWNI" then
23
24             // No input argument: launch help browser
25             if argn(2)==0 then
26                 global %helps
27                 helpbrowser(%helps(:,1), getlanguage());
28                 return
29             end
30
31             if type(key) <> 10 then
32                 error(999,msprintf(_("%s: Wrong type for input argument #%d: string expected.\n"),"help",1));
33             end
34
35             // Search a function name
36             key=stripblanks(key)
37
38             if or(part(key,1)==["(",")","[","]","{","}","%","''","""",":","*","/","\",".","<",">","&","^","|","~","+","-"]) & exists(key)==0 then
39                 key="symbols";
40             end
41
42             // Treat "$" apart because contrarily to the previous symbols, "$" is an existing variable in Scilab
43             if part(key,1)=="$" & (exists(key)==0 | length(key)==1) then
44                 key="symbols";
45             end
46
47             global %helps
48             helpbrowser(%helps(:,1), key, getlanguage(), %f);
49
50             // If the function name does not exists then full-text search is done (See Java code)
51
52         else
53             error(msprintf(gettext("%s: The help browser is disabled in %s mode.\n"), "help", getscilabmode()));
54         end
55     else
56         error(msprintf(gettext("%s: help file(.jar) is not installed.\n"), "help"));
57     end
58
59 endfunction