mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-30 17:53:31 -04:00 
			
		
		
		
	bug/fallback language fix (#708)
* add mealie-next items to gitignore * revert lang to en-US if not found * fix duplicate entries Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
		
							
								
								
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -149,4 +149,9 @@ dev/data/backups/dev_sample_data*.zip | ||||
| !dev/data/backups/test*.zip | ||||
| dev/data/recipes/* | ||||
| dev/scripts/output/app_routes.py | ||||
| dev/scripts/output/javascriptAPI/* | ||||
| dev/scripts/output/javascriptAPI/* | ||||
| mealie/services/scraper/ingredient_nlp/model.crfmodel | ||||
| .gitignore | ||||
| frontend/.nuxt/** | ||||
| frontend/static/sw.js | ||||
| dev/code-generation/generated/* | ||||
|   | ||||
| @@ -5,6 +5,42 @@ from mealie.schema.category import CategoryBase, RecipeCategoryResponse | ||||
| from pydantic import validator | ||||
| from slugify import slugify | ||||
|  | ||||
| # Cluge Validator for ISSUE: #671 | ||||
| langs = { | ||||
|     "el-GR", | ||||
|     "it-IT", | ||||
|     "ko-KR", | ||||
|     "es-ES", | ||||
|     "ja-JP", | ||||
|     "zh-CN", | ||||
|     "tr-TR", | ||||
|     "ar-SA", | ||||
|     "hu-HU", | ||||
|     "pt-PT", | ||||
|     "no-NO", | ||||
|     "sv-SE", | ||||
|     "ro-RO", | ||||
|     "sk-SK", | ||||
|     "uk-UA", | ||||
|     "pl-PL", | ||||
|     "da-DK", | ||||
|     "pt-BR", | ||||
|     "de-DE", | ||||
|     "ca-ES", | ||||
|     "sr-SP", | ||||
|     "cs-CZ", | ||||
|     "fr-FR", | ||||
|     "zh-TW", | ||||
|     "af-ZA", | ||||
|     "ru-RU", | ||||
|     "he-IL", | ||||
|     "nl-NL", | ||||
|     "en-US", | ||||
|     "en-GB", | ||||
|     "fi-FI", | ||||
|     "vi-VN", | ||||
| } | ||||
|  | ||||
|  | ||||
| class SiteSettings(CamelModel): | ||||
|     language: str = "en-US" | ||||
| @@ -29,6 +65,12 @@ class SiteSettings(CamelModel): | ||||
|             } | ||||
|         } | ||||
|  | ||||
|     @validator("language") | ||||
|     def language_validator(cls, v: str): | ||||
|         if v not in langs: | ||||
|             return "en-US" | ||||
|         return v | ||||
|  | ||||
|  | ||||
| class CustomPageBase(CamelModel): | ||||
|     name: str | ||||
|   | ||||
| @@ -20,7 +20,7 @@ def test_default_settings(api_client: TestClient, api_routes: AppRoutes, default | ||||
|  | ||||
|  | ||||
| def test_update_settings(api_client: TestClient, api_routes: AppRoutes, default_settings, admin_token): | ||||
|     default_settings["language"] = "fr" | ||||
|     default_settings["language"] = "fr-FR" | ||||
|     default_settings["showRecent"] = False | ||||
|  | ||||
|     response = api_client.put(api_routes.site_settings, json=default_settings, headers=admin_token) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user