Skip to content

Commit c4e6c2a

Browse files
committed
Creator default language is "default". Title translations in tests JSON.
1 parent 0274d68 commit c4e6c2a

4 files changed

Lines changed: 130 additions & 47 deletions

File tree

surveyjs/creator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class SurveyCreator:
2222
def __init__(
2323
self,
2424
schema_json,
25-
language='en',
25+
language='default',
2626
i18n=None,
2727
element_class_mapping={},
2828
**kwargs

surveyjs/elements/panel.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ class QuestionPanel(Layout):
1212
Panels group questions together. They are not input elements themselves.
1313
"""
1414

15-
@property
16-
def panel_title(self):
17-
return self.raw.get('title', '')
18-
1915
@property
2016
def state(self):
2117
"""Panel state: 'default', 'collapsed', or 'expanded'."""

tests/data/test_survey_schema.json

Lines changed: 116 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
{
1111
"type": "text",
1212
"name": "firstName",
13-
"title": "First Name",
13+
"title": {
14+
"default": "First Name",
15+
"nl": "Voornaam"
16+
},
1417
"description": "Enter your first name",
1518
"isRequired": true,
1619
"placeholder": "John"
@@ -19,22 +22,31 @@
1922
"type": "text",
2023
"name": "lastName",
2124
"startWithNewLine": false,
22-
"title": "Last Name",
25+
"title": {
26+
"default": "Last Name",
27+
"nl": "Achternaam"
28+
},
2329
"description": "Enter your last name",
2430
"isRequired": true,
2531
"placeholder": "Doe"
2632
},
2733
{
2834
"type": "text",
2935
"name": "birthDate",
30-
"title": "Birth Date",
36+
"title": {
37+
"default": "Birth Date",
38+
"nl": "Geboortedatum"
39+
},
3140
"inputType": "date"
3241
},
3342
{
3443
"type": "text",
3544
"name": "age",
3645
"startWithNewLine": false,
37-
"title": "Age",
46+
"title": {
47+
"default": "Age",
48+
"nl": "Leeftijd"
49+
},
3850
"inputType": "number",
3951
"min": 0,
4052
"max": 150,
@@ -53,7 +65,10 @@
5365
{
5466
"type": "text",
5567
"name": "email",
56-
"title": "Email",
68+
"title": {
69+
"default": "Email",
70+
"nl": "E-mail"
71+
},
5772
"inputType": "email",
5873
"maxLength": 100,
5974
"validators": [
@@ -66,13 +81,19 @@
6681
"type": "text",
6782
"name": "appointmentTime",
6883
"startWithNewLine": true,
69-
"title": "Appointment Time",
84+
"title": {
85+
"default": "Appointment Time",
86+
"nl": "Afspraaktijd"
87+
},
7088
"inputType": "datetime-local"
7189
},
7290
{
7391
"type": "comment",
7492
"name": "bio",
75-
"title": "Biography",
93+
"title": {
94+
"default": "Biography",
95+
"nl": "Biografie"
96+
},
7697
"description": "Tell us about yourself",
7798
"maxLength": 500,
7899
"rows": 4,
@@ -88,7 +109,10 @@
88109
{
89110
"type": "radiogroup",
90111
"name": "favoriteColor",
91-
"title": "Favorite Color",
112+
"title": {
113+
"default": "Favorite Color",
114+
"nl": "Favoriete kleur"
115+
},
92116
"isRequired": true,
93117
"choices": [
94118
{"value": "red", "text": "Red"},
@@ -104,7 +128,10 @@
104128
{
105129
"type": "checkbox",
106130
"name": "hobbies",
107-
"title": "Hobbies",
131+
"title": {
132+
"default": "Hobbies",
133+
"nl": "Hobby's"
134+
},
108135
"choices": [
109136
{"value": "reading", "text": "Reading"},
110137
{"value": "sports", "text": "Sports"},
@@ -122,7 +149,10 @@
122149
{
123150
"type": "dropdown",
124151
"name": "country",
125-
"title": "Country",
152+
"title": {
153+
"default": "Country",
154+
"nl": "Land"
155+
},
126156
"choices": [
127157
{"value": "us", "text": "United States"},
128158
{"value": "uk", "text": "United Kingdom"},
@@ -136,7 +166,10 @@
136166
{
137167
"type": "tagbox",
138168
"name": "skills",
139-
"title": "Skills",
169+
"title": {
170+
"default": "Skills",
171+
"nl": "Vaardigheden"
172+
},
140173
"choices": [
141174
{"value": "python", "text": "Python"},
142175
{"value": "javascript", "text": "JavaScript"},
@@ -151,7 +184,10 @@
151184
{
152185
"type": "imagepicker",
153186
"name": "favoritePet",
154-
"title": "Favorite Pet",
187+
"title": {
188+
"default": "Favorite Pet",
189+
"nl": "Favoriet huisdier"
190+
},
155191
"choices": [
156192
{"value": "dog", "text": "Dog", "imageLink": "https://example.com/dog.png"},
157193
{"value": "cat", "text": "Cat", "imageLink": "https://example.com/cat.png"},
@@ -167,7 +203,10 @@
167203
{
168204
"type": "ranking",
169205
"name": "priorityItems",
170-
"title": "Prioritize Items",
206+
"title": {
207+
"default": "Prioritize Items",
208+
"nl": "Items prioriteren"
209+
},
171210
"choices": [
172211
{"value": "price", "text": "Price"},
173212
{"value": "quality", "text": "Quality"},
@@ -186,7 +225,10 @@
186225
{
187226
"type": "boolean",
188227
"name": "agreeTerms",
189-
"title": "I agree to the Terms of Service",
228+
"title": {
229+
"default": "I agree to the Terms of Service",
230+
"nl": "Ik ga akkoord met de servicevoorwaarden"
231+
},
190232
"labelTrue": "Yes",
191233
"labelFalse": "No",
192234
"valueTrue": "agreed",
@@ -196,7 +238,10 @@
196238
{
197239
"type": "rating",
198240
"name": "satisfaction",
199-
"title": "Overall Satisfaction",
241+
"title": {
242+
"default": "Overall Satisfaction",
243+
"nl": "Algemene tevredenheid"
244+
},
200245
"rateMin": 1,
201246
"rateMax": 10,
202247
"rateStep": 1,
@@ -208,7 +253,10 @@
208253
{
209254
"type": "signaturepad",
210255
"name": "signature",
211-
"title": "Your Signature",
256+
"title": {
257+
"default": "Your Signature",
258+
"nl": "Uw handtekening"
259+
},
212260
"signatureWidth": 500,
213261
"signatureHeight": 200,
214262
"penColor": "#000000",
@@ -219,14 +267,20 @@
219267
{
220268
"type": "expression",
221269
"name": "fullName",
222-
"title": "Full Name",
270+
"title": {
271+
"default": "Full Name",
272+
"nl": "Volledige naam"
273+
},
223274
"expression": "{firstName} + ' Smith'",
224275
"displayStyle": "none"
225276
},
226277
{
227278
"type": "file",
228279
"name": "resume",
229-
"title": "Upload Resume",
280+
"title": {
281+
"default": "Upload Resume",
282+
"nl": "CV uploaden"
283+
},
230284
"storeDataAsText": true,
231285
"allowMultiple": true,
232286
"maxSize": 5242880,
@@ -241,7 +295,10 @@
241295
{
242296
"type": "matrix",
243297
"name": "qualityMatrix",
244-
"title": "Rate the quality",
298+
"title": {
299+
"default": "Rate the quality",
300+
"nl": "Beoordeel de kwaliteit"
301+
},
245302
"columns": [
246303
{"value": "poor", "text": "Poor"},
247304
{"value": "fair", "text": "Fair"},
@@ -258,7 +315,10 @@
258315
{
259316
"type": "matrixdropdown",
260317
"name": "budgetMatrix",
261-
"title": "Annual Budget",
318+
"title": {
319+
"default": "Annual Budget",
320+
"nl": "Jaarlijks budget"
321+
},
262322
"columns": [
263323
{"name": "q1", "title": "Q1", "cellType": "text"},
264324
{"name": "q2", "title": "Q2", "cellType": "text"},
@@ -274,7 +334,10 @@
274334
{
275335
"type": "matrixdynamic",
276336
"name": "employeeList",
277-
"title": "Employee List",
337+
"title": {
338+
"default": "Employee List",
339+
"nl": "Werknemerslijst"
340+
},
278341
"columns": [
279342
{"name": "name", "title": "Name", "cellType": "text"},
280343
{"name": "role", "title": "Role", "cellType": "dropdown", "choices": ["developer", "designer", "manager"]},
@@ -288,7 +351,10 @@
288351
{
289352
"type": "multipletext",
290353
"name": "address",
291-
"title": "Address",
354+
"title": {
355+
"default": "Address",
356+
"nl": "Adres"
357+
},
292358
"items": [
293359
{"name": "street", "title": "Street"},
294360
{"name": "city", "title": "City"},
@@ -306,27 +372,39 @@
306372
{
307373
"type": "panel",
308374
"name": "contactPanel",
309-
"title": "Contact Information",
375+
"title": {
376+
"default": "Contact Information",
377+
"nl": "Contactgegevens"
378+
},
310379
"state": "expanded",
311380
"innerIndent": 1,
312381
"elements": [
313382
{
314383
"type": "text",
315384
"name": "phone",
316-
"title": "Phone Number"
385+
"title": {
386+
"default": "Phone Number",
387+
"nl": "Telefoonnummer"
388+
}
317389
},
318390
{
319391
"type": "text",
320392
"name": "website",
321-
"title": "Website",
393+
"title": {
394+
"default": "Website",
395+
"nl": "Website"
396+
},
322397
"inputType": "url"
323398
}
324399
]
325400
},
326401
{
327402
"type": "paneldynamic",
328403
"name": "education",
329-
"title": "Education History",
404+
"title": {
405+
"default": "Education History",
406+
"nl": "Opleidingsgeschiedenis"
407+
},
330408
"templateTitle": "Education #{panelIndex}",
331409
"panelCount": 1,
332410
"minPanelCount": 0,
@@ -339,17 +417,26 @@
339417
{
340418
"type": "text",
341419
"name": "institution",
342-
"title": "Institution"
420+
"title": {
421+
"default": "Institution",
422+
"nl": "Instelling"
423+
}
343424
},
344425
{
345426
"type": "text",
346427
"name": "degree",
347-
"title": "Degree"
428+
"title": {
429+
"default": "Degree",
430+
"nl": "Diploma"
431+
}
348432
},
349433
{
350434
"type": "text",
351435
"name": "year",
352-
"title": "Year",
436+
"title": {
437+
"default": "Year",
438+
"nl": "Jaar"
439+
},
353440
"inputType": "number"
354441
}
355442
]

0 commit comments

Comments
 (0)