-
Notifications
You must be signed in to change notification settings - Fork 54
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 #94 from jacobmolby/feat/add-missing-locales
feat(locales): add locales et, fi, sv and uk. Updated nb.
- Loading branch information
Showing
5 changed files
with
303 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/*eslint-disable no-template-curly-in-string*/ | ||
|
||
import { printValue, LocaleObject } from 'yup'; | ||
|
||
// Based on https://github.com/jquense/yup/blob/b940eef48eb7456622ae384d0ffa7363d4fbad25/src/locale.ts | ||
export const mixed: LocaleObject['mixed'] = { | ||
default: '${path} on kehtetu', | ||
required: '${path} on nõutav väli', | ||
defined: '${path} tuleb määratleda', | ||
notNull: '${path} ei tohi olla null', | ||
oneOf: '${path} peab olema üks järgmistest väärtustest: ${values}', | ||
notOneOf: '${path} ei tohi olla üks järgmistest väärtustest: ${values}', | ||
notType: ({ path, type, value, originalValue }) => { | ||
const isCast = originalValue != null && originalValue !== value; | ||
let msg = | ||
`${path} peab olema \`${type}\` tüüp, ` + | ||
`kuid lõppväärtus oli: \`${printValue(value, true)}\`` + | ||
(isCast | ||
? ` (valatud väärtusest \`${printValue(originalValue, true)}\`).` | ||
: '.'); | ||
|
||
if (value === null) { | ||
msg += | ||
`\nKui "null" on mõeldud tühjaks väärtuseks, märkige skeem kindlasti kui` + | ||
' `.nullable()`'; | ||
} | ||
|
||
return msg; | ||
}, | ||
}; | ||
|
||
export const string: LocaleObject['string'] = { | ||
length: '${path} peab olema täpselt ${length} tähemärki', | ||
min: '${path} peab olema vähemalt ${min} tähemärki', | ||
max: '${path} peab olema maksimaalselt ${max} tähemärki', | ||
matches: '${path} peab vastama järgmisele: "${regex}"', | ||
email: '${path} peab olema kehtiv e-kiri', | ||
url: '${path} peab olema kehtiv URL', | ||
uuid: '${path} peab olema kehtiv UUID', | ||
trim: '${path} peab olema kärbitud string', | ||
lowercase: '${path} peab olema väiketähtedes', | ||
uppercase: '${path} peab olema suurtähtedes', | ||
}; | ||
|
||
export const number: LocaleObject['number'] = { | ||
min: '${path} peab olema suurem või võrdne ${min}', | ||
max: '${path} peab olema väiksem või võrdne ${max}', | ||
lessThan: '${path} peab olema väiksem kui ${less}', | ||
moreThan: '${path} peab olema suurem kui ${more}', | ||
positive: '${path} peab olema positiivne arv', | ||
negative: '${path} peab olema negatiivne arv', | ||
integer: '${path} peab olema täisarv', | ||
}; | ||
|
||
export const date: LocaleObject['date'] = { | ||
min: '${path} peab olema hilisem kui ${min}', | ||
max: '${path} peab olema varasem kui ${max}', | ||
}; | ||
|
||
export const boolean: LocaleObject['boolean'] = { | ||
isValue: '${path} peab olema ${value}', | ||
}; | ||
|
||
export const object: LocaleObject['object'] = { | ||
noUnknown: | ||
'${path} ei tohi sisaldada võtmeid, mis pole objekti kujus täpsustatud', | ||
}; | ||
|
||
export const array: LocaleObject['array'] = { | ||
min: '${path} peab sisaldama vähemalt ${min} eset', | ||
max: '${path} võib sisaldada maksimaalselt ${max} eset', | ||
length: '${path} peab sisaldama täpselt ${length} eset', | ||
}; |
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,73 @@ | ||
/*eslint-disable no-template-curly-in-string*/ | ||
|
||
import { printValue, LocaleObject } from 'yup'; | ||
|
||
// Based on https://github.com/jquense/yup/blob/b940eef48eb7456622ae384d0ffa7363d4fbad25/src/locale.ts | ||
export const mixed: LocaleObject['mixed'] = { | ||
default: '${path} on virheellinen', | ||
required: '${path} on vaadittu kenttä', | ||
defined: '${path} on määriteltävä', | ||
notNull: '${path} ei voi olla tyhjä', | ||
oneOf: '${path} on oltava yksi seuraavista arvoista: ${values}', | ||
notOneOf: '${path} ei saa olla yksi seuraavista arvoista: ${values}', | ||
notType: ({ path, type, value, originalValue }) => { | ||
const isCast = originalValue != null && originalValue !== value; | ||
let msg = | ||
`${path} on oltava \`${type}\` tyyppi, ` + | ||
`mutta lopullinen arvo oli: \`${printValue(value, true)}\`` + | ||
(isCast | ||
? ` (muunnettu arvosta \`${printValue(originalValue, true)}\`).` | ||
: '.'); | ||
|
||
if (value === null) { | ||
msg += | ||
`\n Jos "null" on tarkoitettu tyhjäksi arvoksi, muista merkitä skeema` + | ||
' `.nullable()`'; | ||
} | ||
|
||
return msg; | ||
}, | ||
}; | ||
|
||
export const string: LocaleObject['string'] = { | ||
length: '${path} on oltava tarkalleen ${length} merkkiä', | ||
min: '${path} on oltava ainakin ${min} merkkiä', | ||
max: '${path} on oltava korkeintaan ${max} merkkiä', | ||
matches: '${path} on vastattava seuraavaa: "${regex}"', | ||
email: '${path} on oltava kelvollinen sähköposti', | ||
url: '${path} on oltava kelvollinen URL-osoite', | ||
uuid: '${path} on oltava kelvollinen UUID', | ||
trim: '${path} on oltava leikattu merkkijono', | ||
lowercase: '${path} on oltava pienillä kirjaimilla', | ||
uppercase: '${path} on oltava isoilla kirjaimilla', | ||
}; | ||
|
||
export const number: LocaleObject['number'] = { | ||
min: '${path} on oltava suurempi tai yhtä suuri kuin ${min}', | ||
max: '${path} on oltava pienempi tai yhtä suuri kuin ${max}', | ||
lessThan: '${path} on oltava vähemmän kuin ${less}', | ||
moreThan: '${path} on oltava suurempi kuin ${more}', | ||
positive: '${path} on oltava positiivinen luku', | ||
negative: '${path} on oltava negatiivinen luku', | ||
integer: '${path} on oltava kokonaisluku', | ||
}; | ||
|
||
export const date: LocaleObject['date'] = { | ||
min: '${path} kentän on oltava myöhemmin kuin ${min}', | ||
max: '${path} kentän on oltava aikaisemmin kuin ${max}', | ||
}; | ||
|
||
export const boolean: LocaleObject['boolean'] = { | ||
isValue: '${path} kentän on oltava ${value}', | ||
}; | ||
|
||
export const object: LocaleObject['object'] = { | ||
noUnknown: | ||
'${path} kentällä ei voi olla avaimia, joita ei ole määritetty objektin muodossa', | ||
}; | ||
|
||
export const array: LocaleObject['array'] = { | ||
min: '${path} kentällä on oltava vähintään ${min} kohdetta', | ||
max: '${path} kentällä on oltava enintään ${max} kohdetta', | ||
length: '${path} on oltava tarkalleen ${length} kohdetta', | ||
}; |
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,72 @@ | ||
/*eslint-disable no-template-curly-in-string*/ | ||
|
||
import { printValue, LocaleObject } from 'yup'; | ||
|
||
// Based on https://github.com/jquense/yup/blob/b940eef48eb7456622ae384d0ffa7363d4fbad25/src/locale.ts | ||
export const mixed: LocaleObject['mixed'] = { | ||
default: '${path} är ogiltig', | ||
required: '${path} är ett obligatoriskt fält', | ||
defined: '${path} måste definieras', | ||
notNull: '${path} kan inte vara null', | ||
oneOf: '${path} måste vara ett av följande värden: ${values}', | ||
notOneOf: '${path} får inte vara ett av följande värden: ${values}', | ||
notType: ({ path, type, value, originalValue }) => { | ||
const isCast = originalValue != null && originalValue !== value; | ||
let msg = | ||
`${path} måste vara en \`${type}\` typ, ` + | ||
`men det slutliga värdet var: \`${printValue(value, true)}\`` + | ||
(isCast | ||
? ` (gjutet från värdet \`${printValue(originalValue, true)}\`).` | ||
: '.'); | ||
|
||
if (value === null) { | ||
msg += | ||
`\n Om "null" är avsett som ett tomt värde måste du markera schemat som` + | ||
' `.nullable()`'; | ||
} | ||
|
||
return msg; | ||
}, | ||
}; | ||
|
||
export const string: LocaleObject['string'] = { | ||
length: '${path} måste vara exakt ${length} tecken', | ||
min: '${path} måste vara minst ${min} tecken', | ||
max: '${path} måste vara högst ${max} tecken', | ||
matches: '${path} måste matcha följande: "${regex}"', | ||
email: '${path} måste vara en giltig e-postadress', | ||
url: '${path} måste vara en giltig URL', | ||
uuid: '${path} måste vara en giltig UUID', | ||
trim: '${path} måste vara en trimmad sträng', | ||
lowercase: '${path} måste vara små bokstäver', | ||
uppercase: '${path} måste vara stora bokstäver', | ||
}; | ||
|
||
export const number: LocaleObject['number'] = { | ||
min: '${path} måste vara större än eller lika med ${min}', | ||
max: '${path} måste vara mindre än eller lika med ${max}', | ||
lessThan: '${path} måste vara mindre än ${less}', | ||
moreThan: '${path} måste vara större än ${more}', | ||
positive: '${path} måste vara ett positivt tal', | ||
negative: '${path} måste vara ett negativt tal', | ||
integer: '${path} måste vara ett heltal', | ||
}; | ||
|
||
export const date: LocaleObject['date'] = { | ||
min: '${path} fältet måste vara senare än ${min}', | ||
max: '${path} fältet måste vara tidigare än ${max}', | ||
}; | ||
|
||
export const boolean: LocaleObject['boolean'] = { | ||
isValue: '${path} fältet måste vara ${value}', | ||
}; | ||
|
||
export const object: LocaleObject['object'] = { | ||
noUnknown: '${path} fältet kan inte ha nycklar som inte anges i objektformen', | ||
}; | ||
|
||
export const array: LocaleObject['array'] = { | ||
min: '${path} fältet måste ha minst ${min} föremål', | ||
max: '${path} fältet måste ha mindre än eller lika med ${max} föremål', | ||
length: '${path} måste ha ${length} föremål', | ||
}; |
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,72 @@ | ||
/*eslint-disable no-template-curly-in-string*/ | ||
|
||
import { printValue, LocaleObject } from 'yup'; | ||
|
||
// Based on https://github.com/jquense/yup/blob/b940eef48eb7456622ae384d0ffa7363d4fbad25/src/locale.ts | ||
export const mixed: LocaleObject['mixed'] = { | ||
default: '${path} недійсне', | ||
required: '${path} - це необхідне поле', | ||
defined: '${path} потрібно визначити', | ||
notNull: '${path} не може бути нульовим', | ||
oneOf: '${path} повинен бути одним із наступних значень: ${values}', | ||
notOneOf: '${path} не повинен бути одним із наступних значень: ${values}', | ||
notType: ({ path, type, value, originalValue }) => { | ||
const isCast = originalValue != null && originalValue !== value; | ||
let msg = | ||
`${path} повинен бути \`${type}\` тип, ` + | ||
`але остаточне значення було: \`${printValue(value, true)}\`` + | ||
(isCast | ||
? ` (відігравати зі значення \`${printValue(originalValue, true)}\`).` | ||
: '.'); | ||
|
||
if (value === null) { | ||
msg += | ||
`\n Якщо "null" призначений як порожнє значення, обов'язково позначте схему як` + | ||
' `.nullable()`'; | ||
} | ||
|
||
return msg; | ||
}, | ||
}; | ||
|
||
export const string: LocaleObject['string'] = { | ||
length: '${path} повинні бути саме ${length} персонажами', | ||
min: '${path} повинні бути принаймні ${min} персонажами', | ||
max: '${path} повинні бути максимум ${max} персонажами', | ||
matches: '${path} повинен відповідати наступному: "${regex}"', | ||
email: '${path} повинен бути дійсним електронним листом', | ||
url: '${path} повинен бути дійсною URL -адресою', | ||
uuid: '${path} повинен бути дійсним uuid', | ||
trim: '${path} повинен бути обрізаний рядок', | ||
lowercase: '${path} повинен бути малі рядком', | ||
uppercase: '${path} повинен бути верхнім рядком', | ||
}; | ||
|
||
export const number: LocaleObject['number'] = { | ||
min: '${path} повинен бути більшим або рівним ${min}', | ||
max: '${path} повинен бути меншим або рівним ${max}', | ||
lessThan: '${path} повинен бути менше ${less}', | ||
moreThan: '${path} повинен бути більшим, ніж ${more}', | ||
positive: '${path} повинен бути додатним числом', | ||
negative: "${path} повинен бути від'ємним числом", | ||
integer: '${path} повинно бути цілим числом', | ||
}; | ||
|
||
export const date: LocaleObject['date'] = { | ||
min: '${path} поле повинно бути пізніше ${min}', | ||
max: '${path} поле повинно бути раніше ${max}', | ||
}; | ||
|
||
export const boolean: LocaleObject['boolean'] = { | ||
isValue: '${path} поле повинно бути ${value}', | ||
}; | ||
|
||
export const object: LocaleObject['object'] = { | ||
noUnknown: "${path} поле не може мати клавіш, не вказані у формі об'єкта", | ||
}; | ||
|
||
export const array: LocaleObject['array'] = { | ||
min: '${path} поле повинно мати принаймні ${min} пункти', | ||
max: '${path} поле повинно мати менше або дорівнює ${max} предметам', | ||
length: '${path} повинні мати ${length} пункти', | ||
}; |