-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from VIVOMEDIA/use-i18n
Use i18n from neos project
- Loading branch information
Showing
5 changed files
with
94 additions
and
44 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
Resources/Private/Validators/JsonValidator/src/JsonValidator/index.js
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,18 @@ | ||
import React from 'react'; | ||
import I18n from '@neos-project/neos-ui-i18n'; | ||
|
||
const JsonValidator = (value) => { | ||
try { | ||
if (value === "") { | ||
return null; | ||
} | ||
|
||
JSON.parse(value); | ||
} catch (error) { | ||
return <I18n id="VIVOMEDIA.NeosUI.JsonValidator:Main:NotValidJson" fallback="Not a valid JSON string"/> | ||
} | ||
|
||
return null; | ||
|
||
} | ||
export default JsonValidator; |
17 changes: 0 additions & 17 deletions
17
Resources/Private/Validators/JsonValidator/src/JsonValidator/index.tsx
This file was deleted.
Oops, something went wrong.
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,10 +1,9 @@ | ||
import manifest from '@neos-project/neos-ui-extensibility'; | ||
import createJsonValidator from './JsonValidator'; | ||
import JsonValidator from './JsonValidator'; | ||
|
||
manifest('VIVOMEDIA.NeosUI.JsonValidator:JsonValidator', {}, globalRegistry => { | ||
|
||
const i18nRegistry = globalRegistry.get('i18n'); | ||
const validatorRegistry = globalRegistry.get('validators'); | ||
|
||
validatorRegistry.set('VIVOMEDIA.NeosUI.JsonValidator/Validation/JsonValidator', createJsonValidator({ i18nRegistry })); | ||
validatorRegistry.set('VIVOMEDIA.NeosUI.JsonValidator/Validation/JsonValidator', JsonValidator); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.