mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 19:49:01 +01:00 
			
		
		
		
	server: Update locale when switching language from settings
This commit is contained in:
		
							parent
							
								
									af67362ad6
								
							
						
					
					
						commit
						9f6f0f5d60
					
				| @ -5,6 +5,7 @@ import log from "../../services/log.js"; | ||||
| import searchService from "../../services/search/services/search.js"; | ||||
| import ValidationError from "../../errors/validation_error.js"; | ||||
| import { Request } from 'express'; | ||||
| import { changeLanguage } from "../../services/i18n.js"; | ||||
| 
 | ||||
| // options allowed to be updated directly in the Options dialog
 | ||||
| const ALLOWED_OPTIONS = new Set([ | ||||
| @ -108,6 +109,11 @@ function update(name: string, value: string) { | ||||
| 
 | ||||
|     optionService.setOption(name, value); | ||||
| 
 | ||||
|     if (name === "locale") { | ||||
|         // This runs asynchronously, so it's not perfect, but it does the trick for now.
 | ||||
|         changeLanguage(value); | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -41,4 +41,8 @@ function getCurrentLanguage() { | ||||
|   } | ||||
| 
 | ||||
|   return language; | ||||
| } | ||||
| } | ||||
| 
 | ||||
| export function changeLanguage(locale: string) { | ||||
|   return i18next.changeLanguage(locale); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran