Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Get Current Address App #3761

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Add Get Current Address App #3761

wants to merge 14 commits into from

Conversation

gellnerm
Copy link
Contributor

Add the "Get Current Address App"

It uses the GPS and compass capabilities of the Bangle.js 2 watch to display your current location and direction.

Copy link
Collaborator

@bobrippling bobrippling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea! Just one comment about localisation

function getStreetAndHouseNumber(lat, lon) {
const url = `${nominatimApi}/reverse`;
const paramsStr = Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&');
const fullUrl = `${url}?${paramsStr}&lat=${lat}&lon=${lon}&accept-language=de&format=json`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we configure this based on the user's language?

Suggested change
const fullUrl = `${url}?${paramsStr}&lat=${lat}&lon=${lon}&accept-language=de&format=json`;
const fullUrl = `${url}?${paramsStr}&lat=${lat}&lon=${lon}&accept-language=${lang}&format=json`;

@gfwilliams do we have a way of getting the language name from locale? I can't find any atm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

>require("locale").name # "de_DE"

const lang = require("locale").name.substring(0, 2)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the PR with your suggestion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow I didn't spot name - nice.

One thing to note is that the default might be "system", perhaps we detect that and fallback to a default such as "de" or "en" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. I have updated the PR.

Dynamically get device language
Add fallback for "system" language
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants