blob: 4375da3ff7c58aa35c2788d33dc213b661356a4d [file] [log] [blame]
Tom Sepez2b0ed942015-02-27 13:58:29 -08001// Copyright 2014 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "../../include/javascript/resource.h"
8
9CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT id)
10{
11 switch (id)
12 {
13 case IDS_STRING_JSALERT:
14 return L"Alert";
15 case IDS_STRING_JSPARAMERROR:
16 return L"Incorrect number of parameters passed to function.";
17 case IDS_STRING_JSAFNUMBER_KEYSTROKE:
18 return L"The input value is invalid.";
19 case IDS_STRING_JSPARAM_TOOLONG:
20 return L"The input value is too long.";
21 case IDS_STRING_JSPARSEDATE:
22 return L"The input value can't be parsed as a valid date/time (%s).";
23 case IDS_STRING_JSRANGE1:
24 return L"The input value must be greater than or equal to %s"
25 L" and less than or equal to %s.";
26 case IDS_STRING_JSRANGE2:
27 return L"The input value must be greater than or equal to %s.";
28 case IDS_STRING_JSRANGE3:
29 return L"The input value must be less than or equal to %s.";
30 case IDS_STRING_NOTSUPPORT:
31 return L"Operation not supported.";
32 case IDS_STRING_JSBUSY:
33 return L"System is busy.";
34 case IDS_STRING_JSEVENT:
35 return L"Duplicate formfield event found.";
36 case IDS_STRING_RUN:
37 return L"Script ran successfully.";
38 case IDS_STRING_JSPRINT1:
39 return L"The second parameter can't be converted to a Date.";
40 case IDS_STRING_JSPRINT2:
41 return L"The second parameter is an invalid Date!";
Tom Sepez3a832662015-03-02 12:59:05 -080042 case IDS_STRING_JSNOGLOBAL:
Tom Sepez2b0ed942015-02-27 13:58:29 -080043 return L"Global value not found.";
Tom Sepez3a832662015-03-02 12:59:05 -080044 case IDS_STRING_JSREADONLY:
45 return L"Cannot assign to readonly property.";
Tom Sepeze5350ef2015-04-23 18:14:26 -070046 case IDS_STRING_JSTYPEERROR:
47 return L"Incorrect parameter type.";
48 case IDS_STRING_JSVALUEERROR:
49 return L"Incorrect parameter value.";
Tom Sepez2b0ed942015-02-27 13:58:29 -080050 default:
51 return L"";
52 }
53}
Tom Sepez3a832662015-03-02 12:59:05 -080054
55CFX_WideString JSFormatErrorString(const char* class_name,
56 const char* property_name,
57 const CFX_WideString& details) {
58 CFX_WideString result = CFX_WideString::FromLocal(class_name);
59 if (property_name) {
60 result += L".";
61 result += CFX_WideString::FromLocal(property_name);
62 }
63 result += L": ";
64 result += details;
65 return result;
66}