| 
									
										
										
										
											2023-06-30 13:36:02 +02:00
										 |  |  | import { Validator } from "../Validator" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default class TranslationValidator extends Validator { | 
					
						
							| 
									
										
										
										
											2023-08-23 11:11:53 +02:00
										 |  |  |     public readonly isMeta = true | 
					
						
							| 
									
										
										
										
											2023-06-30 13:36:02 +02:00
										 |  |  |     constructor() { | 
					
						
							|  |  |  |         super("translation", "Makes sure the the string is of format `Record<string, string>` ") | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-24 23:45:20 +01:00
										 |  |  |     isValid(value: string): boolean { | 
					
						
							| 
									
										
										
										
											2023-06-30 13:36:02 +02:00
										 |  |  |         try { | 
					
						
							|  |  |  |             JSON.parse(value) | 
					
						
							|  |  |  |             return true | 
					
						
							|  |  |  |         } catch (e) { | 
					
						
							|  |  |  |             return false | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |