Closed (fixed)
Project:
Metatag
Version:
7.x-1.x-dev
Component:
Multilingual/intl
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Oct 2013 at 18:30 UTC
Updated:
1 Dec 2016 at 00:18 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mparker17I've been experiencing the same problem.
Here's how to re-create on a fresh site:
drush dl drupal-7.25drush sidrush dl ctools-7.x-1.3 i18n-7.x-1.10 metatag-7.x-1.0-beta7 token-7.x-1.5 variable-7.x-2.3drush en ctools i18n i18n_string metatag token variableadmin/config/regional/language, click "Add language", choose "French (Français)", click "Add language" button.admin/config/regional/language/edit/en, set "Path prefix language code" toenand click "Save language" button.admin/config/regional/language/configure. Enable the "URL" detection method, and click "Save settings".en/admin/config/search/metatags, click "Override" next to "Global". In "Description", enterLorem ipsum in English.. Click "Save".en/admin/config/regional/translate/translate. Set "Limit search to" toMetatagand click "Filter" button. Click "Edit" next to the row with the context "global:description". Set the "French" translation toIpsum Lorem en Français.. Click "Save translations".en/admin/structure/block. Move the "Language switcher (User interface text)" block into the "Header" region (or similar). Click "Save blocks".en/node(i.e.: the front page of the site in English). View the source. Note there is a meta tag<meta name="description" content="Lorem ipsum in English." />.Expected behaviour
There is a meta tag
<meta name="description" content="Ipsum lorem en Français." />.Actual behaviour
There is a meta tag
<meta name="description" content="Lorem ipsum in English." />.Comment #2
mparker17Okay, I stepped through
metatag_translate()in a debugger to see what was happening.The problem is the "context" (i.e.:
global:description). When I load the frontpage of my site, instead of using theglobal:descriptionsettings, it uses theglobal:frontpage:descriptionsettings instead (in the code,metatag:is prepended to the above context names).If I delete the "global" setting and put it in the "frontpage" one instead, it works. Put another way, if I change step 9 in my previous comment to say...
Lorem ipsum in English.. Click "Save".... then I would have got my expected functionality (but only for the front page). I'd probably have to do something similar (i.e.: set the translatable string on the 'leaves' of the metatag defaults tree) to get it to work on other pages.
In the case of the description, that's not too bad, since most pages have their own descriptions anyway, but for things like
twitter:site(which is what I'm trying to do on my project, since my client has separate English and French twitter accounts), it's a lot of work.I guess that means this is working as designed, but I'd argue that what it does is not very intuitive and could probably be improved.
Thoughts / suggestions / comments?
Comment #3
Cyclodex commentedI had the same issues and was now looking heavily into this.
There are some tricky parts, for example it also did not work if the string of an element (abstract or description etc.) is the same for frontpage and global. There it doesn't look up correctly the global context.
I am not the metatag or string translation expert, but I could solve the issue which was because of inheritance and context look ups which did not work out correctly.
I will post a patch soon, so you can test if it would work out for you as well.
Just wanted to take over the task for the moment.
Comment #4
damienmckenna@Cyclodex: Were you able to work out a fix?
Comment #5
damienmckennaFYI I'm working on changing the contexts in #1986032: i18n support for Metatag submodules (Views, Context, Panels).
Comment #6
damienmckennaI'm moving back the fixes to this issue, will deal with the submodules separately.
Comment #7
damienmckennaComment #8
damienmckennaDoes this work better?
Comment #9
damienmckennaI'm working on a changenotice for this: https://www.drupal.org/node/2550865
Comment #10
damienmckennaA small tidying of the code, plus extra comments.
Comment #11
damienmckennaI've also added a change notice for the argument changes to metatag_translate(): https://www.drupal.org/node/2550883
Comment #12
damienmckennaCommitted.
Comment #15
kumkum29 commentedHello,
i get the same problem on my site: in the front page only the default metas are displayed.
Step 1:
In en(or fr)/admin/config/search/metatags, I have clicked on "Override" next to "Global: Front page" (or Global). In "Description", i have entered Metas EN and click "Save".
Step 2:
I opens the two home page (EN & FR).
Step 3:
In the translation page, I create the translated string for the description : Metas EN > Metas FR
Step 4:
In the home page of french language I get the description in english...
I have uninstalled and reinstalled the module and I get the same problem.
Here is the print_r(metatag_metatags_view('global:frontpage', array())); in the french home page:
Have you any idea for resolve this problem? Thanks.
P.S.: if I uses a string and a token in the description, the token is translated in the good language. The string isn't translated.
Edit: I have found a solution for the front page with metatag context, but it's not so easy and no option for the global metatags.
Comment #16
damienmckenna@kumkum29: Please open a new issue and I'll be able to help you.
Comment #17
Xrobak commentedmetatag 7.x-1.17 still not fixed... could you update the stable version? thx
Comment #18
damienmckenna@Xrobak: Please open a new issue so I can help you work out the exact source of the problem. Thanks.
Comment #19
Xrobak commented@DamienMcKenna, done #2831198