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

GOOGLE_MAPS_DEFAULT_LANGUAGE #45

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

GOOGLE_MAPS_DEFAULT_LANGUAGE #45

wants to merge 6 commits into from

Conversation

Synkied
Copy link

@Synkied Synkied commented May 21, 2018

This constant can be used to set the default language of the google map widget displayed.

I think it can be useful.

In my case, I'm working with an english client, but work in France, so the google maps API sets the Google Maps iframe to french language (based on my location).

I would like to be able to add items to the database that are in English, so I need to set the Google Maps widget language to English.

Hope this helps !

To use it, you simply have to set the GOOGLE_MAPS_DEFAULT_LANGUAGE in your settings.py file (list of languages: https://developers.google.com/maps/faq#languagesupport)

*I added the constant to settings.py, I forgot in my first PR, my bad.

Synkied added 4 commits May 18, 2018 17:27
This constant can be used to set the default language of the google map widget displayed.

I think it can be useful.

In my case, I'm working with an english client, but work in France, so the google maps API sets the Google Maps iframe to french language (based on my location).

I would like to be able to add items to the database that are in English, so I need to set the Google Maps widget language to English.

Hope this helps !

To use it, you simply have to set the GOOGLE_MAPS_DEFAULT_LANGUAGE in your settings.py file (list of languages: https://developers.google.com/maps/faq#languagesupport)
Added a GOOGLE_MAPS_DEFAULT_LANGUAGE constant
@Synkied
Copy link
Author

Synkied commented May 25, 2018

Hi @madisona

Any news on this PR?

It really is useful IMHO, as explained in my first comment.

Thanks!

@madisona
Copy link
Owner

Hi @Synkied - thanks for your contribution. I agree adding the ability to specify language is useful. Will you re-work it so it isn't a breaking change and existing users don't need to add the setting if they don't want?

@madisona
Copy link
Owner

@Synkied also - you don't need a new branch and new PR - just make your changes and push to your existing branch and github should update this pull request.

@Synkied
Copy link
Author

Synkied commented May 29, 2018

Hi @madisona
I'll do it as soon as I can, should be this week :)

Ok thanks, I'll do that, I'm a bit new in contributing to projects! 👍

@Synkied
Copy link
Author

Synkied commented May 31, 2018

Hi @madisona, I think this should be better, current users won't have to specify the new setting in their settings file. It will automatically take their location language.
Tell me what you think!

@madisona
Copy link
Owner

@Synkied thanks! This is indeed a much better start. the .pytest_cache files don't appear to belong committed to the repository.

On the test cases - I'd like to see one test case testing each possible scenario specifically. For example - test_uses_default_setting_when_declared and test_uses_default_locale_when_setting_not_declared and the test_uses_en_as_fallback. The way it currently is the test is only ever testing the same scenario the user has configured, not all possible scenarios.

Lastly - from the Google Maps documentation it says "By default, the Maps JavaScript API uses the user's preferred language setting as specified in the browser..."

When grabbing the user's locale, don't we need to get it from the request object Accept-Language header? I'm not very familiar with the locale module... is that giving the locale of the server the code is running on or the browser?

@atamano
Copy link

atamano commented Jul 19, 2018

Any news on this PR ?

@Synkied
Copy link
Author

Synkied commented Sep 27, 2018

I would really like some help on the test cases if someone got time to do it?
Else I'll try to find time soon, but can't guarantee it

dlenskyi pushed a commit to dlenskyi/django-google-maps that referenced this pull request Oct 19, 2022
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.

3 participants