forked from MapComplete/MapComplete
Studio: get basic translations working kindoff
This commit is contained in:
parent
2923020575
commit
b58ba665b5
36 changed files with 13542 additions and 15486 deletions
16
UI/InputElement/Validators/TranslationValidator.ts
Normal file
16
UI/InputElement/Validators/TranslationValidator.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { Validator } from "../Validator"
|
||||
|
||||
export default class TranslationValidator extends Validator {
|
||||
constructor() {
|
||||
super("translation", "Makes sure the the string is of format `Record<string, string>` ")
|
||||
}
|
||||
|
||||
isValid(value: string, getCountry?: () => string): boolean {
|
||||
try {
|
||||
JSON.parse(value)
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue