xref: /aosp_15_r20/external/pdfium/fxjs/cjs_globalconsts.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
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 "fxjs/cjs_globalconsts.h"
8 
9 #include "fxjs/fxv8.h"
10 
11 #define GLOBAL_STRING(rt, name, value)                              \
12   (rt)->DefineGlobalConst(                                          \
13       (name), [](const v8::FunctionCallbackInfo<v8::Value>& info) { \
14         info.GetReturnValue().Set(                                  \
15             fxv8::NewStringHelper(info.GetIsolate(), (value)));     \
16       })
17 
18 // static
DefineJSObjects(CJS_Runtime * pRuntime)19 void CJS_GlobalConsts::DefineJSObjects(CJS_Runtime* pRuntime) {
20   GLOBAL_STRING(pRuntime, L"IDS_GREATER_THAN",
21                 "Invalid value: must be greater than or equal to % s.");
22 
23   GLOBAL_STRING(pRuntime, L"IDS_GT_AND_LT",
24                 "Invalid value: must be greater than or equal to % s "
25                 "and less than or equal to % s.");
26 
27   GLOBAL_STRING(pRuntime, L"IDS_LESS_THAN",
28                 "Invalid value: must be less than or equal to % s.");
29 
30   GLOBAL_STRING(pRuntime, L"IDS_INVALID_MONTH", "**Invalid**");
31   GLOBAL_STRING(
32       pRuntime, L"IDS_INVALID_DATE",
33       "Invalid date / time: please ensure that the date / time exists.Field");
34 
35   GLOBAL_STRING(pRuntime, L"IDS_INVALID_VALUE",
36                 "The value entered does not match the format of the field");
37 
38   GLOBAL_STRING(pRuntime, L"IDS_AM", "am");
39   GLOBAL_STRING(pRuntime, L"IDS_PM", "pm");
40   GLOBAL_STRING(pRuntime, L"IDS_MONTH_INFO",
41                 "January[1] February[2] March[3] April[4] May[5] "
42                 "June[6] July[7] August[8] September[9] October[10] "
43                 "November[11] December[12] Sept[9] Jan[1] Feb[2] Mar[3] "
44                 "Apr[4] Jun[6] Jul[7] Aug[8] Sep[9] Oct[10] Nov[11] "
45                 "Dec[12]");
46 
47   GLOBAL_STRING(pRuntime, L"IDS_STARTUP_CONSOLE_MSG", "** ^ _ ^ **");
48 }
49