Skip to content

Commit

Permalink
Merge pull request #1 from VIVOMEDIA/use-i18n
Browse files Browse the repository at this point in the history
Use i18n from neos project
  • Loading branch information
dlubitz authored Feb 16, 2023
2 parents ebeb682 + ccd2195 commit ecd42fa
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 44 deletions.
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;

This file was deleted.

5 changes: 2 additions & 3 deletions Resources/Private/Validators/JsonValidator/src/manifest.js
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);
});
96 changes: 73 additions & 23 deletions Resources/Public/Validators/JsonValidator/Plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Resources/Public/Validators/JsonValidator/Plugin.js.map

Large diffs are not rendered by default.

0 comments on commit ecd42fa

Please sign in to comment.