Skip to content

Commit

Permalink
add locales.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatyana-js committed Jun 26, 2024
1 parent 8705aa4 commit f2eedd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import i18next from 'i18next';
import 'bootstrap';
import axios from 'axios';
import _ from 'lodash';
import validate, { createLink } from './locales/utils.js';
import validate, { createLink } from '../utils.js';
import watch from './view.js';
import ru from './locales/ru.js';
import parse from './parser.js';
Expand Down
6 changes: 6 additions & 0 deletions src/locales/locales.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
mixed: {
url: () => ({ key: 'errors.invalidUrl' }),
notoneOf: () => ({ key: 'errors.existsRss' }),
},
};
8 changes: 2 additions & 6 deletions src/locales/utils.js → utils.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import * as yup from 'yup';
import local from './src/locales/locales.js';

yup.setLocale({
mixed: {
url: () => ({ key: 'errors.invalidUrl' }),
notoneOf: () => ({ key: 'errors.existsRss' }),
},
});
yup.setLocale(local);

const validate = (url, urlFeeds) => {
const schema = yup.object().shape({
Expand Down

0 comments on commit f2eedd0

Please sign in to comment.