mirror of
https://github.com/ansible/awx.git
synced 2026-04-13 05:59:23 -02:30
update awx-pf to use withI18n i18n._ and t exclusively
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
import { i18nMark } from '@lingui/react';
|
||||
|
||||
export function required (message) {
|
||||
return value => {
|
||||
if (!value.trim()) {
|
||||
return message || i18nMark('This field must not be blank');
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
|
||||
export function maxLength (max) {
|
||||
return value => {
|
||||
if (value.trim().length
|
||||
> max) {
|
||||
return i18nMark(`This field must not exceed ${max} characters`);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
20
src/util/validators.jsx
Normal file
20
src/util/validators.jsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { t } from '@lingui/macro';
|
||||
|
||||
export function required (message, i18n) {
|
||||
return value => {
|
||||
if (!value.trim()) {
|
||||
return message || i18n._(t`This field must not be blank`);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
|
||||
export function maxLength (max, i18n) {
|
||||
return value => {
|
||||
if (value.trim().length
|
||||
> max) {
|
||||
return i18n._(t`This field must not exceed ${max} characters`);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user