django-google-maps icon indicating copy to clipboard operation
django-google-maps copied to clipboard

GOOGLE_MAPS_DEFAULT_LANGUAGE

Open Synkied opened this issue 6 years ago • 8 comments

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 avatar May 21 '18 08:05 Synkied

Hi @madisona

Any news on this PR?

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

Thanks!

Synkied avatar May 25 '18 08:05 Synkied

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 avatar May 25 '18 13:05 madisona

@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.

madisona avatar May 25 '18 13:05 madisona

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 avatar May 29 '18 16:05 Synkied

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!

Synkied avatar May 31 '18 13:05 Synkied

@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?

madisona avatar Jun 10 '18 12:06 madisona

Any news on this PR ?

atamano avatar Jul 19 '18 14:07 atamano

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

Synkied avatar Sep 27 '18 16:09 Synkied