-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to JSON Forms 3.0.0-alpha.2 which contains the new i18n customization capatibilities. As AJV is now consumed on version 8 some additional code changes are necessary. Adds an example translation function to the example app.
- Loading branch information
Showing
18 changed files
with
699 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,23 @@ | |
|
||
<v-divider /> | ||
|
||
<v-container> | ||
<v-row><v-col>Locale (Mostly in basic example)</v-col></v-row> | ||
<v-row> | ||
<v-col> | ||
<v-select | ||
outlined | ||
persistent-hint | ||
dense | ||
v-model="locale" | ||
:items="locales" | ||
></v-select> | ||
</v-col> | ||
</v-row> | ||
</v-container> | ||
|
||
<v-divider /> | ||
|
||
<v-container> | ||
<v-row><v-col>Options</v-col></v-row> | ||
<v-row> | ||
|
@@ -170,6 +187,20 @@ | |
</v-tooltip> | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col> | ||
<v-tooltip bottom> | ||
<template v-slot:activator="{ on: onTooltip }"> | ||
<v-switch | ||
v-model="locale" | ||
label="Switch beetwen english and german locale" | ||
v-on="onTooltip" | ||
></v-switch> | ||
</template> | ||
Only applies to basic example | ||
</v-tooltip> | ||
</v-col> | ||
</v-row> | ||
</v-container> | ||
|
||
<v-divider /> | ||
|
@@ -190,6 +221,7 @@ export default { | |
), | ||
restrict: sync('app/[email protected]'), | ||
readonly: sync('app/jsonforms@readonly'), | ||
locale: sync('app/jsonforms@locale'), | ||
}, | ||
data: function () { | ||
return { | ||
|
@@ -199,6 +231,10 @@ export default { | |
{ text: 'Validate And Hide', value: 'ValidateAndHide' }, | ||
{ text: 'No Validation', value: 'NoValidation' }, | ||
], | ||
locales: [ | ||
{ text: 'English (en)', value: 'en' }, | ||
{ text: 'German (de)', value: 'de' }, | ||
], | ||
}; | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import get from 'lodash/get'; | ||
|
||
const en = { | ||
name: { | ||
label: 'Name', | ||
description: 'The name of the person', | ||
}, | ||
vegetarian: { | ||
label: 'Vegetarian', | ||
description: 'Wether the person is a vegetarian', | ||
}, | ||
birth: { | ||
label: 'Birth Date', | ||
description: '', | ||
}, | ||
nationality: { | ||
label: 'Nationality', | ||
description: '', | ||
}, | ||
'personal-data': { | ||
age: { | ||
label: 'Age', | ||
}, | ||
driving: { | ||
label: 'Driving Skill', | ||
description: 'Indicating experience level', | ||
}, | ||
}, | ||
height: { | ||
label: 'Height', | ||
}, | ||
occupation: { | ||
label: 'Occupation', | ||
description: '', | ||
}, | ||
'postal-code': { | ||
label: 'Postal Code', | ||
}, | ||
error: { | ||
required: 'field is required', | ||
}, | ||
}; | ||
|
||
const de = { | ||
name: { | ||
label: 'Name', | ||
description: 'Der Name der Person', | ||
}, | ||
vegetarian: { | ||
label: 'Vegetarier', | ||
description: 'Isst die Person vegetarisch?', | ||
}, | ||
birth: { | ||
label: 'Geburtsdatum', | ||
description: '', | ||
}, | ||
nationality: { | ||
label: 'Nationalität', | ||
description: '', | ||
Other: 'Andere', | ||
}, | ||
'personal-data': { | ||
age: { | ||
label: 'Alter', | ||
}, | ||
driving: { | ||
label: 'Fahrkenntnisse', | ||
description: 'Fahrerfahrung der Person', | ||
}, | ||
}, | ||
height: { | ||
label: 'Größe', | ||
}, | ||
occupation: { | ||
label: 'Beruf', | ||
description: '', | ||
}, | ||
'postal-code': { | ||
label: 'Postleitzahl', | ||
}, | ||
error: { | ||
required: 'Pflichtfeld', | ||
}, | ||
'Additional Information': 'Zusätzliche Informationen', | ||
}; | ||
|
||
export const createTranslator = | ||
(locale: 'en' | 'de') => | ||
(key: string, defaultMessage: string | undefined): string | undefined => { | ||
return get(locale === 'en' ? en : de, key) ?? defaultMessage; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './i18n'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"packages": ["vue2-vuetify", "example"], | ||
"version": "3.0.0-alpha.1" | ||
"version": "3.0.0-alpha.2" | ||
} |
Oops, something went wrong.