mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	preferences: choose language code with one '-'
On initialization, the old code searched for the first language code containing a '-'. However, my Qt version gives de-Latn-DE as the first entry. That messed up the preferences code: it didn't recognize that entry. Thus, simply opening and closing the preferences switched the language to Bulgarian. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
		
							parent
							
								
									889ca23999
								
							
						
					
					
						commit
						cf990b0f39
					
				
					 1 changed files with 4 additions and 8 deletions
				
			
		|  | @ -460,16 +460,12 @@ void initUiLanguage() | |||
| 		loc = QLocale(QLocale().uiLanguages().first()); | ||||
| 	} | ||||
| 
 | ||||
| 	// Find language code with one '-', or use the first entry.
 | ||||
| 	QStringList languages = loc.uiLanguages(); | ||||
| 	QString uiLang; | ||||
| 	if (languages[0].contains('-')) | ||||
| 		uiLang = languages[0]; | ||||
| 	else if (languages.count() > 1 && languages[1].contains('-')) | ||||
| 		uiLang = languages[1]; | ||||
| 	else if (languages.count() > 2 && languages[2].contains('-')) | ||||
| 		uiLang = languages[2]; | ||||
| 	else | ||||
| 		uiLang = languages[0]; | ||||
| 	auto it = std::find_if(languages.begin(), languages.end(), [](const QString &s) | ||||
| 				{ return s.count('-') == 1; }); | ||||
| 	uiLang = it == languages.end() ? languages[0] : *it; | ||||
| 
 | ||||
| 	// there's a stupid Qt bug on MacOS where uiLanguages doesn't give us the country info
 | ||||
| 	if (!uiLang.contains('-') && uiLang != loc.bcp47Name()) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue