| 
									
										
										
										
											2019-04-12 16:44:14 +02:00
										 |  |  | const path = require('path'); | 
					
						
							|  |  |  | require('dotenv').config({ path: path.resolve(__dirname, '../.env') }); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-10 08:48:49 -07:00
										 |  |  | const { curriculum: curriculumLangs } = | 
					
						
							|  |  |  |   require('../config/i18n/all-langs').availableLangs; | 
					
						
							| 
									
										
										
										
											2020-12-16 02:02:52 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-13 17:05:52 +02:00
										 |  |  | exports.testedLang = function testedLang() { | 
					
						
							| 
									
										
										
										
											2020-12-16 02:02:52 -06:00
										 |  |  |   if (process.env.CURRICULUM_LOCALE) { | 
					
						
							|  |  |  |     if (curriculumLangs.includes(process.env.CURRICULUM_LOCALE)) { | 
					
						
							|  |  |  |       return process.env.CURRICULUM_LOCALE; | 
					
						
							| 
									
										
										
										
											2020-08-13 17:05:52 +02:00
										 |  |  |     } else { | 
					
						
							| 
									
										
										
										
											2020-12-16 02:02:52 -06:00
										 |  |  |       throw Error(`${process.env.CURRICULUM_LOCALE} is not a supported language.
 | 
					
						
							| 
									
										
										
										
											2020-08-13 17:05:52 +02:00
										 |  |  |       Before the site can be built, this language needs to be manually approved`);
 | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-12 16:44:14 +02:00
										 |  |  |   } else { | 
					
						
							| 
									
										
										
										
											2020-08-13 17:05:52 +02:00
										 |  |  |     throw Error('LOCALE must be set for testing'); | 
					
						
							| 
									
										
										
										
											2019-04-12 16:44:14 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | }; |