mirror of
				https://github.com/searxng/searxng
				synced 2024-01-01 19:24:07 +01:00 
			
		
		
		
	[fix] convert bytes type to string in language detection (fixes dictzone)
This commit is contained in:
		
							parent
							
								
									7177c9e12f
								
							
						
					
					
						commit
						72459b246b
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -308,14 +308,15 @@ def int_or_zero(num):
 | 
			
		|||
 | 
			
		||||
def is_valid_lang(lang):
 | 
			
		||||
    is_abbr = (len(lang) == 2)
 | 
			
		||||
    lang = lang.lower().decode('utf-8')
 | 
			
		||||
    if is_abbr:
 | 
			
		||||
        for l in language_codes:
 | 
			
		||||
            if l[0][:2] == lang.lower():
 | 
			
		||||
            if l[0][:2] == lang:
 | 
			
		||||
                return (True, l[0][:2], l[3].lower())
 | 
			
		||||
        return False
 | 
			
		||||
    else:
 | 
			
		||||
        for l in language_codes:
 | 
			
		||||
            if l[1].lower() == lang.lower():
 | 
			
		||||
            if l[1].lower() == lang or l[3].lower() == lang:
 | 
			
		||||
                return (True, l[0][:2], l[3].lower())
 | 
			
		||||
        return False
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue