mirror of
				https://github.com/janeczku/calibre-web
				synced 2025-11-04 09:13:02 +00:00 
			
		
		
		
	Merge remote-tracking branch 'lang/patch-1'
This commit is contained in:
		@@ -194,7 +194,13 @@ def get_locale():
 | 
				
			|||||||
        if user.nickname != 'Guest':   # if the account is the guest account bypass the config lang settings
 | 
					        if user.nickname != 'Guest':   # if the account is the guest account bypass the config lang settings
 | 
				
			||||||
            return user.locale
 | 
					            return user.locale
 | 
				
			||||||
    translations = [str(item) for item in babel.list_translations()] + ['en']
 | 
					    translations = [str(item) for item in babel.list_translations()] + ['en']
 | 
				
			||||||
    preferred = [str(LC.parse(x.replace('-','_').replace('*','en'))) for x in request.accept_languages.values()]
 | 
					    preferred = list()
 | 
				
			||||||
 | 
					    for x in request.accept_languages.values():
 | 
				
			||||||
 | 
					        try:
 | 
				
			||||||
 | 
					            preferred.append(str(LC.parse(x.replace('-', '_'))))
 | 
				
			||||||
 | 
					        except (UnknownLocaleError, ValueError) as e:
 | 
				
			||||||
 | 
					            app.logger.debug("Could not parse locale: %s", e)
 | 
				
			||||||
 | 
					            preferred.append('en')
 | 
				
			||||||
    return negotiate_locale(preferred, translations)
 | 
					    return negotiate_locale(preferred, translations)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user