Better error messages on geolocation fetching errors
This commit is contained in:
parent
b792f2ec44
commit
169076dffa
@ -17,8 +17,12 @@ export default {
|
||||
upvote: 'Upvote',
|
||||
},
|
||||
geolocation: {
|
||||
errorFetchingPosition: 'Error fetching your position:',
|
||||
fetching: 'Fetching current position…',
|
||||
geolocation: 'Geolocation',
|
||||
permissionDenied: 'access to your position is denied.',
|
||||
positionUnavailable: 'unable to retrieve your position.',
|
||||
timeout: 'position was too long to acquire.',
|
||||
unavailable: 'Sorry, geolocation is not available in your browser.',
|
||||
},
|
||||
intro: {
|
||||
|
@ -17,8 +17,12 @@ export default {
|
||||
upvote: 'Confirmer',
|
||||
},
|
||||
geolocation: {
|
||||
errorFetchingPosition: 'Impossible de récupérer votre position :',
|
||||
fetching: 'En attente de votre position…',
|
||||
geolocation: 'Géolocalisation',
|
||||
permissionDenied: "l'accès a votre position a été refusé.",
|
||||
positionUnavailable: 'impossible de déterminer votre position.',
|
||||
timeout: 'votre position est trop longue à récupérer.',
|
||||
unavailable: "Désolé, la géolocalisation n'est pas disponible dans votre navigateur.",
|
||||
},
|
||||
intro: {
|
||||
|
@ -139,7 +139,14 @@ export default {
|
||||
}
|
||||
},
|
||||
handlePositionError(error) {
|
||||
this.error = `Error ${error.code}: ${error.message}`;
|
||||
this.error = `${this.$t('geolocation.errorFetchingPosition')} `;
|
||||
if (error.code === 1) {
|
||||
this.error += this.$t('geolocation.permissionDenied');
|
||||
} else if (error.code === 2) {
|
||||
this.error += this.$t('geolocation.positionUnavailable');
|
||||
} else {
|
||||
this.error += this.$t('geolocation.timeout');
|
||||
}
|
||||
},
|
||||
setPosition(position) {
|
||||
if (this.latLng) {
|
||||
|
Loading…
Reference in New Issue
Block a user