Multilingual site - i18n+i18nviews+Metatag+metatag_views. Language as suffix(site.com/en).
Internationalization: i18n.module
------------------------------------------------------------------------------
All default configurations may be translated using the Internationalization
(i18n) module. The custom strings that are assigned to e.g. the "Global: Front
page" configuration will show up in the Translate Interface admin page
(admin/config/regional/translate/translate) and may be customized per language.
---------------------------------------------------------------------------------
This work only for default configuration from Metatag group, but for tags in custom views I can't translate meta tags through translate interface.
Also I can't add translation through path tab - multiligual path's not supported :(.
How to resolve this problems?
Comment | File | Size | Author |
---|---|---|---|
#68 | twitter-n1986032-68.patch | 12.63 KB | DamienMcKenna |
#57 | metatag-n1986032-57.patch | 11.07 KB | DamienMcKenna |
Comments
Comment #1
DamienMcKennaClarifying the title. This needs to be fixed for the final 1.0 release.
Comment #2
yang_yi_cn CreditAttribution: yang_yi_cn commentedstrings in Metatag: Context are also not translatable.
Comment #3
DamienMcKennaDoh, wrote the wrong word.
Comment #4
yang_yi_cn CreditAttribution: yang_yi_cn commentedcreated a patch for the metatag_context module (note that I made the patch on metatag module level).
This patch adds the i18n_string_update() part in add/edit admin forms of the Metatag Context module to allow translations, and pulls the translated value when display.
Comment #5
yang_yi_cn CreditAttribution: yang_yi_cn commentedafter some thoughts I think it's better to have the "context" part in the i18n text string name to avoid namespace conflicts with other metatag modules.
Patch re-rolled.
Comment #6
yang_yi_cn CreditAttribution: yang_yi_cn commentedsorry, the previous patch included some unnecessary stuff related to entity_translation.
Use this one instead.
Comment #7
jorgemaestre CreditAttribution: jorgemaestre commented#6 Thanks yang_yi_cn, patch is working fine for me.
Comment #8
DamienMcKennaComment #10
moonray CreditAttribution: moonray commentedThis patch only fixes Metatag: Context, and not Metatag: Panels or Metatag: Views yet.
It's a good start, but if you're trying out the patch, it's something to be aware of.
Comment #11
DamienMcKennaRelated: #2030427: Integration with i18n_taxonomy for per-language defaults
Comment #12
DamienMcKennaComment #13
N20 CreditAttribution: N20 commentedPatch in #6 failed for me. I think it is important to have Metatag play nice together with transleted contexts. At the moment i can not translate the Metatags for any View.
Comment #14
vflirt CreditAttribution: vflirt commentedHi,
I have similar issue but i needed panels. As metatag panels module is almost ready to implement the translation I added jus a few more lines to get the strings to appear in the translation interface :
changed metatag_panels_form_submit as :
and then in metatag_panels_ctools_render_alter i had to change
$instance = 'panels:' . $handler->name;
to
$instance = 'panels:' . $handler->task . ':' . $handler->subtask . ':' . $handler->name;
as handler->task and handler->subtask give a bit more information where that text come from in the translation inteface.
handler->name is unique so even if stick to default of $instance = 'panels:' . $handler->name; it will be cool .
This has its issues as deleting page/variant will not remove the strings , can't refresh the strings from the administration and so on .
Maybe we could implement something as i18n_panels module does (with the panels uuid patch and ctools-uuis_for_exported_object patch) though they rely on uuid as key but as said the $handler->name is unique and adding task and subtask provide enough meaningful information so when translation the text to have proper information where this text is actually used.
Kind Regards,
Dobromir
Comment #15
stijndmd CreditAttribution: stijndmd commentedConsidering Metatag Views:
Since the only one of the defaults here that isn't translatable is the description, here is kind of an unclean quick fix to make your view description translatable.
I know it's far from ideal, this fix, but if you're also in a hurry and need this now...
Comment #16
Tharna CreditAttribution: Tharna commentedMade this into a patch with a small change of requiring this patch to fix some notices.
Comment #17
alcroito CreditAttribution: alcroito commentedAttaching patch with changes proposed in #14, for Panels i18n.
Comment #18
alcroito CreditAttribution: alcroito commentedAttaching modified patch for panels i18n, that:
1) Checks for existence of i18n_string before trying to update the translation strings.
2) Removes the updated strings if the display / handler / variant is removed.
Comment #19
alcroito CreditAttribution: alcroito commentedHiding old patches.
Attaching new patch that uses function_exists to check for i18n_string, to be more in correspondence with the code used throughout the module.
Comment #20
DamienMcKennaComment #21
pingwin4eg#6 patch for metatag_context works good with metatag 7.x-1.0-beta9.
Comment #22
izus CreditAttribution: izus commentedHi,
for some reason (files headers?), i couldn't apply #19
so i did it manually. and it worked fine for me, i can now have access to strings for translation in the metatag text group
here is the new generated patch file
Thanks
Comment #23
Thytane CreditAttribution: Thytane commentedHello,
I tried the patch for metatag_panels on #22.
Patch OK. No errors when patching.
Just a little trouble if we use i18n feature for panels in a install profile. It's OK to have trads for metatags on panels but if the website is installed by a profile, there is one more action to do.
Translate backoffice said that it doesn't know the metatags strings unless you validate a second time your page_manager configuration. After that it's OK, the string is known and the traduction passed.
Comment #24
Thytane CreditAttribution: Thytane commentedComment #25
Thytane CreditAttribution: Thytane commentedA last thing, this patch (#22) is only for metatag_panels. It would be so great if it's possible to have a similar feature for metatag_views.
The 2 demands are really closed.
Thanks
Comment #26
izus CreditAttribution: izus commentedhi,
following patch takes into account both panels and views.
did you try to refresh strings admin/config/regional/translate/i18n_string beofre testing ?
thx
Comment #27
Nick Robillard CreditAttribution: Nick Robillard commentedConfirmed that patch in #6 works for Context translations
Comment #28
izus CreditAttribution: izus commentedOk
here is a patch for panels views and context.
its just a merge of #6 and #26
Thanks
Comment #29
izus CreditAttribution: izus commentedComment #30
le72What about taxonomy?
Comment #31
izus CreditAttribution: izus commentedhi,
i had an error with #28 for panel :
"Invalid argument supplied for foreach() metatag_panels.module:188"
following patch corrects it
Comment #32
maijs CreditAttribution: maijs commentedI just filed a bug report regarding the fact that Metatag Views module does not allow user to set per-display Metatag settings (see #2289139 - Metatag settings cannot be set for each views display separately). A patch in #31 translates Metatag views settings in the same manner, saving a translation per view, ignoring a display name (translation context is
view:[view-name]:[metatag-field]
).On the assumption that #2289139 is committed and that Metatag settings can be set per display, I'm attaching a patch that takes a patch from #31 and adds support for default and overridden Metatag option states. That is, if Metatag option is default (applies to all displays), translation context includes only view name (
view:[view-name]:[metatag-field]
). If Metatag option is overridden (applies only to one display), then translation context also includes display name (view:[view-name]:[display-name]:[metatag-field]
).Comment #33
DamienMcKennaRemoving this from the 1.0 blocker release, we'll get back to it after the rest of the module is stable. That said, the patch looks good and I appreciate all of the work being put into it, I just want to wait 'til the rest of the module is more stable.
Comment #34
marcusx CreditAttribution: marcusx commentedTested this without any side effects. Works great.
Comment #35
jlmainguy CreditAttribution: jlmainguy commentedHi everyone, I have applied the latest patch and I'm still getting a "Cannot refresh strings for Metatag" message when trying to refresh the strings. I see the translatable text from my Frontpage Global description meta tag, but nothing from my contexts tags (paths). Is anyone else still experiencing this issue?
Comment #36
sylus CreditAttribution: sylus commentedThe latest patch wasn't applying for me on latest dev post v1.4 so attaching updated patch with slightly modified logic to metatag_views as $saved_metatags variable was removed in dev.
Comment #37
DamienMcKennaClosed a duplicate: #2356315: Context title and description translation
Comment #38
m33_nft CreditAttribution: m33_nft commentedlitle fix for patch #36
foreach ($context->reactions['metatag_context_reaction']['metatags']['und'] as $field => $item) {
$name = "metatag:context:" . $context->name . ":" . $field;
i18n_string_update($name, $item['value']);
}
Comment #39
DamienMcKennaRerolled, with the fix from #38 included.
Comment #40
JulienThomas CreditAttribution: JulienThomas commentedThanks for this patch.
However, I faced the same issue as #1781232 and thus site went simply down for non-English pages that were having overridden metatags.
As a safety measure, it may be better to encapsulate call to i18n_string_translate() (as suggested in #1781232)
I attached such a patch
Comment #42
oskylark CreditAttribution: oskylark commentedPatch #39 - I've only tested for metatag_views but perhaps related to the #38 fix, I need to use $metatags[LANGUAGE_NONE] for the final i18n_string_update loop in function options_submit in metatag_views_plugin_display_extender_metatags.inc i.e.
Making this change the saved metatag strings appear in Translate interface as required.
Comment #46
robinudev CreditAttribution: robinudev commentedAny progress on this issue?
Comment #47
rv0 CreditAttribution: rv0 commentedWorking re-roll of the metatag_views patch:
Comment #48
DamienMcKenna@rv0: Thanks for the patch.
Could someone please give the patch in #47 a test run to see how well it works? Is there anything that we could add to README.txt to help explain how the functionality works?
Comment #49
rv0 CreditAttribution: rv0 commentedJust some extra info:
the strings are entered into the i18n system when the metatag part in a view is submitted.
afterwards they are available for translation.
Sadly there is no automated mechanism in this patch to enter all existing views metatags in the i18n system. It would be possible to write though, but for the 6 views pages where I needed it it wasn't worth the effort.
So the functionality could use improving, but it doesn't really have to be a blocker for this patch (might as well be handled in a follow up)
Comment #50
DamienMcKennaI've rolled in yang_yi_cn's patch from #6 into rv0's patch from #47, refactored it a bit so that there were two new functions to handle translations, and added similar support for Metatag:Panels. Please help test this. Thanks!
Comment #52
DamienMcKennaLets see if the tests pass now.
Comment #53
yang_yi_cn CreditAttribution: yang_yi_cn commentedThe last patch doesn't apply cleanly to 7.x-1.6. I reviewed the rejected ones and it looks they are mostly blank space differences. There's really just one difference:
Do we really need add the 'context' module in the test?
Comment #54
DamienMcKenna@yang_yi_cn: Thanks. I find adding the dependencies helps ensure that they're all enabled - it may not strictly be necessary, but it doesn't hurt having it there.
Comment #55
DamienMcKennaRerolled.
Comment #57
DamienMcKennaDoh! Fixed the syntax goof in the Context tests file, and fixed some issues with those tests.
Comment #58
DamienMcKennaCould someone please help test the latest patch? Thanks.
Comment #59
DamienMcKennaComment #60
DamienMcKennaBased upon feedback in #2113501: Translated global metatag defaults do not display (show originals instead), I'm going to try out removing the $instance portion of the translation contexts, so that the context for a title would be "global:description" instead of e.g. "global:frontpage:description".
Comment #62
DamienMcKennaCopy/paste fail.
Comment #64
DamienMcKennaI'll eventually get the hang of this search/replace thing :(
Comment #65
DamienMcKennaFound another occurrence of metatag_translate() being called.
Comment #66
DamienMcKennaNeeds to be rerolled since #2113501: Translated global metatag defaults do not display (show originals instead) was committed.
Comment #67
DamienMcKennaRerolled.
Comment #68
DamienMcKennaI made some further improvements.
Comment #70
DamienMcKennaCommitted. Thanks everyone!
Comment #72
nlambert CreditAttribution: nlambert as a volunteer commentedI think there might still be a problem.
I've added a meta description to my variant: http://take.ms/dPMpK
Then I added another to another Panels Page.
The second is overriding the first: http://take.ms/QyAOc
I see the context is "metatag:metatag:description". Should this be "metatag:metatag:description:$pid" or something similar?
I didn't dive into the code, and haven't read every comment in this thread but I think it might be right to reopen this issue. Maybe the right procedure would be to open another ticket? Not sure. Let me know.
Comment #73
VISIOS CreditAttribution: VISIOS commentedSame problem here as in #72. This might be a serious blocker because all of my custom title metatags in the translated language have been overwritten . Don't try this on production sites :)
Can anybody confirm this bug?
Comment #74
DamienMcKennaFYI I'm working on tests to confirm everything's where it should be, I'm hoping to have a working patch tomorrow sometime, then we can haggle on how it should work and fix the things that aren't working right.
Comment #75
chegor CreditAttribution: chegor as a volunteer commentedThe same problem as in as in #72. For me that's in views. One context metatag:description (or metatag:og:description f.e.) for all views.
Comment #76
DamienMcKennaLets focus on #2564483: Cannot translate metatags after last update anymore.