mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix(locale): Use navigator.language as default locale.
This commit is contained in:
		
							parent
							
								
									b744368720
								
							
						
					
					
						commit
						d471abbbb0
					
				| @ -26,9 +26,7 @@ export default class ShowUserComponent extends React.Component { | ||||
|     } | ||||
| 
 | ||||
|     updateLocale() { | ||||
|         const locale = this.props.location | ||||
|             ? this.props.location.locale | ||||
|             : this.possibleLocales[this.possibleLocales.length - 1]; | ||||
|         const locale = (this.props.location && this.props.location.locale) || navigator.language; | ||||
|         let index = this.possibleLocales.findIndex(v => v.value === locale); | ||||
|         index = (index + 1) % this.possibleLocales.length; | ||||
|         this.props.updateSettingLocation('locale', this.possibleLocales[index].value); | ||||
| @ -36,9 +34,7 @@ export default class ShowUserComponent extends React.Component { | ||||
| 
 | ||||
|     render() { | ||||
|         const email = this.props.profile ? this.props.profile.email : ''; | ||||
|         const locale = this.props.location | ||||
|             ? this.props.location.locale | ||||
|             : this.possibleLocales[this.possibleLocales.length - 1].value; | ||||
|         const locale = (this.props.location && this.props.location.locale) || navigator.language; | ||||
|         let foundLocale = this.possibleLocales.find(l => l.value === locale); | ||||
|         const imageUrl = email ? this.props.profile.imageUrl : 'public/unknown-user.png'; | ||||
|         const imageLocale = foundLocale ? `public/${foundLocale.image}.png` : `public/unknown-locale.png`; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user