Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi there,
I started to port the module to D7.
I've modified the geoip_language module to use the new language provider system: http://api.drupal.org/api/function/hook_language_negotiation_info/7
The configuration page is now here:
admin/config/regional/language/configure/geoip
Attention: Work is still in progress, this is just a first step.
@Maintainer: How about a new D7 branch?
Port sponsored by Cando Image GmbH
Cheers,
Peter
Comment | File | Size | Author |
---|---|---|---|
#67 | interdiff.txt | 2.03 KB | derhasi |
#67 | geoip-7.x-port-887268-67.patch | 57.44 KB | derhasi |
#67 | interdiff-to-65.txt | 61.85 KB | derhasi |
#65 | geoip-port-geoip-to-d7-887268-63.patch | 22.36 KB | zardoc-1 |
#64 | geoip-port-geoip-to-d7-887268-63.patch | 22.36 KB | zardoc-1 |
Comments
Comment #1
drewish CreditAttribution: drewish commentedThanks for posting this. I've got a couple of small tweaks I want to make before I fork it for DRUPAL-6--1. Then HEAD will be all about D7.
Comment #2
jpstrikesback CreditAttribution: jpstrikesback commentedSubscribe
Comment #3
rickvug CreditAttribution: rickvug commentedNote that Drupal 7 core includes a function to return an array of countries. Call the following code:
It makes sense to use this data in Drupal 7 rather than have geoip.values.inc.
Comment #4
rickvug CreditAttribution: rickvug commentedNote that this array will need to have "Anonymous Proxy" and "Satellite Provider" added.
Comment #5
BenK CreditAttribution: BenK commentedSubscribing...
Comment #6
das-peter CreditAttribution: das-peter commented@rickvug Thanks for the hint, I use this function now to fetch the iso3166 codes. The function
_geoip_country_values
is still in place to extend the country list with the special codes defined by MaxMindComment #7
rickvug CreditAttribution: rickvug commented@das-peter - Excellent. Would you be able to post your work as a patch so that this can become the official D7 branch?
Comment #8
das-peter CreditAttribution: das-peter commentedSure, here is it.
Hope this works ;)Found some coding standard violations - will fix them and provide another patch
Comment #9
das-peter CreditAttribution: das-peter commentedTried to catch all the nasty little tabs, missing dots and so on.
Comment #10
drewish CreditAttribution: drewish commentedI only got half way through this but here's what I came across.
I'd like to make sure this gets applied to 6.x:
Typo/I'm not sure that's the Drupal way of specifying types:
Incorrect indenting on the initial * and we don't declare @return if there's no value:
This doesn't look like the Doxygen standards unless they've changed them for D7:
Comments need to be complete sentences. Also with is misspelled.
Have we checked to see which labels have changed now that _geoip_country_values() is calling country_get_list()? We'll need to document it if any have.
geoip_language_mappings() Should be using the new drupal_static() rather than its own static variable.
Comment #11
das-peter CreditAttribution: das-peter commentedYou recognized it, I'm still trying to get used to the damn Doxygen standard - don't like it because it isn't supported by Eclipse's PDT ;) (Thus I fallback into phpDoc style all the time)
They are added to the country list in
_geoip_country_values
.The Drupal country list contains these additional codes:
But since they're additional, geoip shouldn't be affected negatively.
The only thing we should be aware of is that modules are able to alter the Drupal country list with hook_countries_alter.
If we want to prevent this, we've to use
_country_get_predefined_list
geoip_language_mappings
uses nowdrupal_static
Comment #12
das-peter CreditAttribution: das-peter commentedI played around and added token & rule integration of geoip. It's my first implementation of that kind - means a review is warmly welcome :)
I think the integration in these modules makes the module even more flexible.
Of course there are still open points - currently only country is integrated. City & region integration should follow.
The patch in this comment contains only the integration for rules & token.
Shall I open a new feature request for this?
Comment #13
drewish CreditAttribution: drewish commentedI'll give this a longer review this afternoon. Lets put the token stuff into another feature because I'd like to see if it's feasible to backport it to the D6 branch.
Comment #14
Damien Tournoud CreditAttribution: Damien Tournoud commentedGently pointing everyone to: http://api.drupal.org/api/function/hook_countries_alter/7
Comment #15
klonos...subscribing. Can we get these (#11 and #12) in a dev release please? That way we'll be getting update notifications through the sites' 'Available updates' section when there's something new to test. Thanx in advance ;)
Comment #16
okokokok CreditAttribution: okokokok commentedLooking forward to a dev release.
Comment #17
das-peter CreditAttribution: das-peter commentedUpdated patch - that's the version I'm using atm.
Comment #18
klonos...patching against latest 6.x dev 29-Oct-2010:
So I went on and patched it manually (the two failing files actually). Just thought I'd let you know. Will report back after testing.
Comment #19
klonos...here it is for those testers out there that have trouble patching (rename from
.tar_.gz
to.tar.gz
):Comment #20
xurizaemonPatch from #17 updated to apply to current HEAD.
Comment #21
TR CreditAttribution: TR commentedIn the patch,
The names should be wrapped in t(). That's what country_get_list() does for all the pre-defined country names.
Comment #22
xurizaemonGood point, thanks.
Comment #23
klonos...again, here is the patched module for those testers out there that have trouble patching (rename from
.tar_.gz
to.tar.gz
):Note: the patch has a couple of hiccups when applied either against the latest 6.x-1.x-dev (2011-Feb-17) or against 6.x-1.3:
...so I patched geoip.info and geoip_language.info manually.
Comment #24
benone CreditAttribution: benone commentedsub
Comment #25
xurizaemonIncluding the module name makes it obvious which issue is on your dashboard :)
Comment #26
drewish CreditAttribution: drewish commentedre-rolled the patch. i've created a 7.x branch that we can commit this to once it's sorted.
Comment #27
drewish CreditAttribution: drewish commentedComment #28
drewish CreditAttribution: drewish commentedI committed a bunch of the simple stuff to the 7.x branch. Here's the more complicated stuff that I want to be able review closely.
Comment #29
klonos...proper version then ;)
Comment #30
paulgemini CreditAttribution: paulgemini commentedsubbing
Comment #31
shadowmihai CreditAttribution: shadowmihai commentedsubscribe
Comment #32
chriscohen CreditAttribution: chriscohen commentedSubscribe. I will potentially need something like this in D7 for an upcoming project, so if it all works out, I would be happy to help where needed on the D7 version.
Comment #33
mgiffordSo to get this to a full release we need to verify that the patch applies to the git head, run it through coder and see that it's ok, what else?
@drewish thanks for the patch in March. I haven't used this module yet, but would like to soon.
Comment #34
annikaC CreditAttribution: annikaC commentedsubscribing.
Comment #35
linora CreditAttribution: linora commentedsubscribing
Comment #36
CyberschorschHi,
I tested the 7.x-1.x-dev branch and it works fine for me.
Comment #37
klonosThe 7.x dev has been around since past March and usage stats report ~25 sites using it. I guess what remains to be done is make the 7.x-1.x-dev available in the project's front page and we should close this issue here. This was about an initial port and now we can file other specific problems in their own separate issues.
Comment #38
RdeBoerAgree with klonos, #37. Please make a dev or alpha version available, so that it's more obvious that a decent D7 version exists.
I'm using the "hidden" 7.x.dev version of GeoIP API in combination with IP Geolocation and it works wonderfully. So it would be great if we can make the synergy between these two modules more apparent for the community at large.
Comment #40
klonosSorry for re-opening, but there still is no 7.x version available in the project's front page and no statement that there is a D7 port in the project's description either.
Comment #41
dukem CreditAttribution: dukem commentedI created new geoip_language module, based on quova_locale. It is using hook_language_negotiation_info().
It is just a starter and yet to be reworked or improved - language mapping must be added. Maybe it will help someone.
Also had to change geoip_country_code() function a little.
In order for it to work place it in the second place after URL in "Detection and Selection". Also English must have a prefix - 'en'. So when there is no prefix in url it will fallback to the IP detection.
Patch applies to the current 7.x-1.x release.
Comment #42
das-peter CreditAttribution: das-peter commentedI've just created a sandbox with the version we use in our company: http://drupal.org/sandbox/daspeter/1446796
Sandbox is the current 7.x-1.x branch including token & rules support.
@dukem: I've given you VCS access on the sandbox. Feel free to push your enhancements if you'd like ;)
Comment #43
dukem CreditAttribution: dukem commentedImproved patch from #41, added mapping, also no changes needed to the geoip_country_code() function.
@das-peter: pushed to the sandbox, i hope i didn't break something - 1st time committing something to Drupal. :)
Patch applies to the current 7.x-1.x release.
Comment #44
das-peter CreditAttribution: das-peter commented@dukem: Awesome, thanks. :)
Comment #45
andyhu CreditAttribution: andyhu commentedsubscribing, thanks for your good work!
Comment #46
mgiffordChanging this to needs review for #43. @andyhu & @das-peter does it work?
Comment #47
sokrplare CreditAttribution: sokrplare commented@drewish / @zroger - could one of you get the 7.x dev release on the project page? This was by far the best module for my use case, but almost missed it as it didn't appear any 7.x work was happening. I've put the current dev release in place and it works perfectly (as also confirmed by #37 and #38 above).
There are a few D6 cleanup items (ie admin menu change) remaining, but we can get patches going for that.
I'm marking this as RTBC even though I know #43 hasn't been resolved, but IMO we first need to get 7.x up and then can start filing patches like that against it separately - otherwise we'll never have a 7.x release in the first place and this thread will get overrun.
Comment #48
drewish CreditAttribution: drewish commentedThe -dev snapshot should now show up. I've got no idea what the status of that branch is though. Is there a patch that needs go on?
Comment #49
drewish CreditAttribution: drewish commentedSeems odd to be removing the schema stuff for geoip_language_schema... If we're killing off that functionality it seems like it should at least have a cleanup hook_update_N function. Yeah it's actually removing a lot of functionality and tests.
Comment #50
sokrplare CreditAttribution: sokrplare commentedThanks, drewish! Really great to have that dev branch up there!
Comment #51
yang_yi_cn CreditAttribution: yang_yi_cn commentedthe dev version shows the date of the dev version is still 2011-Mar-10 and it's not quite working.
Can someone try to fix the dev branch?
Comment #52
xurizaemon@yang_yi_cn, 7.x-1.x was last updated 16 months ago (march 2010), so that tarball is correct. You can now help get the dev branch fixed by filing detailed reports (or even patches) against 7.x-1.x.
Comment #53
RdeBoerI like others am confused... So no patch has actually been applied to the branch/dev.snap shot since March 2010?
What happened to dukem's patch (#43) ? Can we get that applied to get the ball rolling?
Comment #54
drewish CreditAttribution: drewish commentedI commented on it already. It needs work. It's dropping a big chunk of functionality.
Comment #55
das-peter CreditAttribution: das-peter commentedI've just merged the new JS stuff from the 6.x Version into my sandbox.
I also added some other stuff but I was sloppy and didn't test much.
Let's clarify some things first:
Yes, I could imagine that someone would like to have a table to be able to use SQL.
The downside I see is that it's not supported by Features.
I preferred the ability to export the configuration using Features, using Strongarm.
Thus the mapping is stored in a variable: http://drupalcode.org/sandbox/daspeter/1446796.git/blob/refs/heads/cando...
August 18, 2010
. I wasn't to interested to keep up with the 6.x developing because of the lack of feedback and because the initial port fulfilled my needs.However, the topic seems to be resurrected. So let's get this done, I'll help wherever I can!
Comment #56
drewish CreditAttribution: drewish commentedWe were using the schema stuff when was at Sony to direct countries to languages... we were sort of mis-using the languages to act as regions. I think you're right that it's kind of wacky... I'm okay with dropping it for the limitations you'd outlined. If it needs to be in D7 it can get updated.
I do think the JS changes are useful and should be brought forward.
Comment #57
das-peter CreditAttribution: das-peter commentedThanks for the feedback.
I continued the porting.
Looks like all functionality is working.
Upgrade path is also available now, the data from the table are ported to the variable.
All code passes drupalcs *yay*
The only thing that's open are the tests. I've started to port them but stuck now with the language redirection - I'm not even sure if in 7.x a redirect has to happen.
Input very welcome.
Attached patch should apply to the 7.x branch - or you can merge the changes directly from my sandbox: http://drupalcode.org/sandbox/daspeter/1446796.git
Comment #58
Lukas von BlarerI added a property to the site entity to be able to do data comparisons in rules.
Until now I wasn't able to test the patch on a server. I am developing locally. As soon as I did so, I will provide feedback.
Comment #59
HyperGlide CreditAttribution: HyperGlide commentedAny update on a stable d7 branch?
Comment #60
Lukas von BlarerUntil now the changes I made worked.
@HyperGlide: Please review the patch to get it committed.
Comment #61
HyperGlide CreditAttribution: HyperGlide commented@Lukas von Blarer: We have been looking to use drupal.org/project/smart_ip for our needs.
If there is a change I will test and revert back.
Comment #62
djg_tram CreditAttribution: djg_tram commentedThe config URL should be admin/config/regional/geoip, both in the module and in the .info file.
Comment #63
zardoc-1 CreditAttribution: zardoc-1 commentedHere is a patch for a working version of the geoip_language sub module that allows mappings of IP country names to Drupal internal languages.
Comment #64
zardoc-1 CreditAttribution: zardoc-1 commentedComment #65
zardoc-1 CreditAttribution: zardoc-1 commentedPlease review the patch and add any changes or comments you think are necessary towards getting a stable release of the module rolled out for Drupal 7.
Comment #66
derhasi CreditAttribution: derhasi commented@zardoc, the changes in your patch, are out of scope. The language negotiation itself, shall do nothing but, get the language. There shall be no automatic redirect by the processor. It would be better to leave that redirect to a dedicated module that uses a generic approach (besides GeoIP, a redirect may be valid for Browser or session too).
Lukas' patch from #58 looks way better, as it focuses on the task.
Needs work, as we should change the URL, as mentioned in #62
Comment #67
derhasi CreditAttribution: derhasi commentedHere's a reapplied patch from #58.
Comment #68
joelpittet@derhasi That's awsome #67 works great so far, no errors on the admin pages at least or through install. I'll be trying this out some more and will report back but otherwise I'd like to say RTBC++
Comment #69
das-peter CreditAttribution: das-peter commentedI've just got maintainer permissions for the module and published my previously forked 7.x-2.x branch.
The beta1 should be available soon (waiting for the d.o. provisioning system).
Here are the upcoming release notes:
Module completely overhauled.
Attention:
New Features
Currently missing features
Comment #70
RdeBoerA few years later I repeat my comment in #38... Great news!
Thanks das-peter for all your work!
Rik
Comment #71
joelpittet@das-peter cool!
I was playing with a custom module to implement MaxMind GeoIP2, xautoload made short work of it and was fun:)
/sites/all/composer.json
Just mostly a demo of how xautoload and composer made short work of managing the dependent OOP libraries.
Comment #72
das-peter CreditAttribution: das-peter commentedI'm indeed not to happy with the way I had to handle the composer things. Maybe we can change that.
Comment #73
bojanz CreditAttribution: bojanz at Centarro commentedThere are two D7 branches, safe to say a port was made :)
Comment #74
joelpittetMight be worth switching up the recommended releases for D7 and the branches on the project page?