Hi,

Tried looking for this in the forum, but couldn't find it, so here goes.

So I have a site, and it has 3 urls.

1. example.com
2. de.example.com
3. fr.example.com

Each site has language settings based on the url. For example, de.example.com is german language only.

Some of my modules have a multi lingual variable set as well. For example, I have Google CSE, and I search only german sites (pre set on my CSE account). So for each domain, I have a CX key for each particular search engine.

However, once I enable the mobile-tools, I no longer have access to these multi lingual variables. They all default to english (I have several) which is the default site language. But with Mobile-tools module disabled, everything works fine.

I'm fairly new to Drupal, so I am not sure if there's a simple setting I can use to fix this or what, but it's a really big problem for me at the moment as these sites need to be language specific. Any ideas or suggestions?

CommentFileSizeAuthor
#3 mobile_tools_i18n_fix.1035832.patch1.38 KByang_yi_cn

Comments

thezombieguy’s picture

Further testing shows me that not all my multi lingual variables are lost. Only ones that are needed in the url.

For example, the google CSE cx is part of a search string in google. There are multiple ids, but it seems that the query is always getting the default id.

I set up some other strings on the site to test, and ones that display in page are fine. Just url related ones are not. My guess would be that when the mobile tools does its thing with the url, something gets rewritten in the query, and the request doesn't get updated properly. I don't know exactly what that is, but I will investigate further.

florisg’s picture

Same problem here,
It comes from the fact that you can only specify two domains.
->Mobile url.
->Desktop URL: *

However: With the domain module you can set these settings for mobile_tools for each domain :)

in my case:
m-en.domain.tld as the mobile site for en.domain.tld (english language)
m.domain.tld as the mobile site for domain.tld (dutch language)
same for french (m-fr) and german (m-de).

Now the mobile_tools and language domain keeps on bouncing back and forth.

The solution:
hook_link_alter in the mobile-theme's template.php to rewrite links in full: http://m-XX.domain.tld .
Finally patch the i18nstrings to always look for translations depending on the version reference to:
http://drupal.org/node/745540#comment-3578764
http://drupal.org/node/676002

It's not a very clean solution, but it works :)

yang_yi_cn’s picture

Status: Active » Needs review
StatusFileSize
new1.38 KB

I've created a patch which fixes this problem.

The problem is because that

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);  

was called twice when the user is being redirected from regular view to mobile view. And it looks like it's not a good idea to call bootstrap twice as some modules are doing initialization stuff and can get messed up.

So, I instead call DRUPAL_BOOTSTRAP_PATH as the beginning, we only need that to get the normal path from _GET[q]. Then, after we know where we should redirect, then we do a full bootstrap and that will load all i18n variables correctly.

twom’s picture

Status: Needs review » Fixed

Thx for the patch!

Actually I can just replace all the DRUPAL_BOOTSTRAP_FULL occurrences by the _PATH version!

Is committed to the dev branch.

shadysamir’s picture

Version: 6.x-2.1 » 6.x-2.x-dev

I am using path prefix for language switching. Mobile tools ignores the language from the URL when redirecting.

Opening
www.example.com/en/node/1
from a mobile device redirects to
m.example.com/node/1

Using latest dev (supposedly with this patch committed)

shadysamir’s picture

Priority: Major » Normal
Status: Fixed » Active

Sorry forgot to change status

yang_yi_cn’s picture

Status: Active » Closed (fixed)

You problem is different and you should open a new issue for that.

Please don't reopen this issue.

shadysamir’s picture

Sorry I thought it was the same issue since it was related to language variables in redirect.

mcgovernm’s picture

I'm running into a very similar problem, but instead of changing the theme, i'm redirecting to a completely different website that I have no control over. I have mysite.com, ca.mysite.com, and mx.mysite.com... the redirect should go to m.mysite.com. It appears that when hitting ca. or mx. mobile tools redirects you to the default desktop URL, which does not contain the region-based subdomain. If anyone has any insight on this is would be greatly appreciated!