Better error messages on geolocation fetching errors
This commit is contained in:
parent
b792f2ec44
commit
169076dffa
@ -17,8 +17,12 @@ export default {
|
|||||||
upvote: 'Upvote',
|
upvote: 'Upvote',
|
||||||
},
|
},
|
||||||
geolocation: {
|
geolocation: {
|
||||||
|
errorFetchingPosition: 'Error fetching your position:',
|
||||||
fetching: 'Fetching current position…',
|
fetching: 'Fetching current position…',
|
||||||
geolocation: 'Geolocation',
|
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.',
|
unavailable: 'Sorry, geolocation is not available in your browser.',
|
||||||
},
|
},
|
||||||
intro: {
|
intro: {
|
||||||
|
@ -17,8 +17,12 @@ export default {
|
|||||||
upvote: 'Confirmer',
|
upvote: 'Confirmer',
|
||||||
},
|
},
|
||||||
geolocation: {
|
geolocation: {
|
||||||
|
errorFetchingPosition: 'Impossible de récupérer votre position :',
|
||||||
fetching: 'En attente de votre position…',
|
fetching: 'En attente de votre position…',
|
||||||
geolocation: 'Géolocalisation',
|
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.",
|
unavailable: "Désolé, la géolocalisation n'est pas disponible dans votre navigateur.",
|
||||||
},
|
},
|
||||||
intro: {
|
intro: {
|
||||||
|
@ -139,7 +139,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handlePositionError(error) {
|
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) {
|
setPosition(position) {
|
||||||
if (this.latLng) {
|
if (this.latLng) {
|
||||||
|
Loading…
Reference in New Issue
Block a user