Problem/Motivation

i18n support is broken.

Proposed resolution

Fix i18n support.

Remaining tasks

Review the latest patch.

Things to decide:

  • For the tag output, is it ok that the meta tags are only translated *after* the tokens are replaced, i.e. it works on the final output? This means that it is no longer possible to e.g. use different tokens for different locales.
  • Is the context value for meta tag output translations the way it should be done?
  • Are there any problems with the current implementation, gaps in the functionality or any bugs?
  • Is there anything else that can be improved?
  • Besides the current plan to finish the update script to convert all meta tags to the new metatag_config structure, is there anything else which needs an update script?
  • Any other feedback?

User interface changes

None.

API changes

TBD.

Data model changes

TBD.

Original issue

I cannot translate metatags anymore after the latest update 1.7, and all previous translations are gone.
I tried to search for strings, and found them but when translating it says translation saved but still not translated.

CommentFileSizeAuthor
#193 metatag-n2564483-193.interdiff.txt4.83 KBDamienMcKenna
#193 metatag-n2564483-193.patch183.52 KBDamienMcKenna
#191 metatag-n2564483-191.patch182.12 KBDamienMcKenna
#191 metatag-n2564483-191.interdiff.txt9.79 KBDamienMcKenna
#190 metatag-n2564483-190.interdiff.txt3.45 KBDamienMcKenna
#190 metatag-n2564483-190.patch173.84 KBDamienMcKenna
#187 metatag-n2564483-187.interdiff.txt3.35 KBDamienMcKenna
#187 metatag-n2564483-187.patch173.17 KBDamienMcKenna
#182 metatag-n2564483-182.patch172.4 KBDamienMcKenna
#182 metatag-n2564483-182.interdiff.txt3.02 KBDamienMcKenna
#181 metatag-n2564483-181.interdiff.txt22.51 KBDamienMcKenna
#181 metatag-n2564483-181.patch171.59 KBDamienMcKenna
#180 metatag-n2564483-180.interdiff.txt1.7 KBDamienMcKenna
#180 metatag-n2564483-180.patch155.76 KBDamienMcKenna
#177 metatag-n2564483-177.interdiff.txt497 bytesDamienMcKenna
#177 metatag-n2564483-177.patch155.7 KBDamienMcKenna
#174 metatag-n2564483-174.interdiff.txt12.17 KBDamienMcKenna
#174 metatag-n2564483-174.patch155.69 KBDamienMcKenna
#171 metatag-n2564483-171.patch156.26 KBDamienMcKenna
#171 metatag-n2564483-171.interdiff.txt1.79 KBDamienMcKenna
#167 metatag-n2564483-167.interdiff.txt9.11 KBDamienMcKenna
#167 metatag-n2564483-167.patch156.33 KBDamienMcKenna
#166 metatag-n2564483-166.interdiff.txt9.34 KBDamienMcKenna
#166 metatag-n2564483-166.patch156.77 KBDamienMcKenna
#165 metatag-n2564483-165.patch148.02 KBDamienMcKenna
#165 metatag-n2564483-165.interdiff.txt27.1 KBDamienMcKenna
#163 metatag-n2564483-163.patch141.62 KBDamienMcKenna
#163 metatag-n2564483-163.interdiff.txt15.75 KBDamienMcKenna
#162 metatag-n2564483-161.patch134.31 KBDamienMcKenna
#162 metatag-n2564483-161.interdiff.txt517 bytesDamienMcKenna
#161 metatag-n2564483-161.patch134.31 KBDamienMcKenna
#161 metatag-n2564483-161.interdiff.txt517 bytesDamienMcKenna
#160 metatag-n2564483-160.patch134.3 KBDamienMcKenna
#160 metatag-n2564483-160.interdiff.txt7.73 KBDamienMcKenna
#157 metatag-n2564483-157.interdiff.txt11.06 KBDamienMcKenna
#157 metatag-n2564483-157.patch134.26 KBDamienMcKenna
#155 metatag-n2564483-155.interdiff.txt8.73 KBDamienMcKenna
#155 metatag-n2564483-155.patch132.19 KBDamienMcKenna
#142 metatag-n2564483-142.interdiff.txt5.88 KBDamienMcKenna
#142 metatag-n2564483-142.patch130.09 KBDamienMcKenna
#141 metatag-n2564483-141.interdiff.txt12.98 KBDamienMcKenna
#141 metatag-n2564483-141.patch125.31 KBDamienMcKenna
#134 metatag-n2564483-134.interdiff.txt3.84 KBDamienMcKenna
#134 metatag-n2564483-134.patch122.3 KBDamienMcKenna
#129 metatag-n2564483-129.interdiff.txt10.42 KBDamienMcKenna
#129 metatag-n2564483-129.patch119.08 KBDamienMcKenna
#126 2564483-126.patch124.28 KBwebflo
#126 2564483-126.interdiff.txt575 byteswebflo
#124 metatag-n2564483-124.patch118.97 KBDamienMcKenna
#124 metatag-n2564483-124.interdiff.txt11.56 KBDamienMcKenna
#114 metatag-n2564483-114.patch115.73 KBDamienMcKenna
#113 metatag-n2564483-113.patch115.76 KBDamienMcKenna
#111 metatag-n2564483-111.patch113.59 KBDamienMcKenna
#111 metatag-n2564483-111.interdiff.txt28.75 KBDamienMcKenna
#110 metatag-n2564483-110.patch108.56 KBDamienMcKenna
#110 metatag-n2564483-110.interdiff.txt3.82 KBDamienMcKenna
#106 metatag-n2564483-106.patch108.55 KBDamienMcKenna
#106 metatag-n2564483-106.interdiff.txt4.09 KBDamienMcKenna
#105 metatag-n2564483-105.patch105.55 KBDamienMcKenna
#105 metatag-n2564483-105.interdiff.txt3.17 KBDamienMcKenna
#102 metatag-n2564483-102.patch103.49 KBDamienMcKenna
#102 metatag-n2564483-102.interdiff.txt7.13 KBDamienMcKenna
#98 metatag-n2564483-98.interdiff.txt23.34 KBDamienMcKenna
#98 metatag-n2564483-98.patch97.54 KBDamienMcKenna
#94 metatag-n2564483-95.patch85.84 KBDamienMcKenna
#94 metatag-n2564483-95.interdiff.txt1.15 KBDamienMcKenna
#93 metatag-n2564483-93.patch85.09 KBDamienMcKenna
#93 metatag-n2564483-93.interdiff.txt2.21 KBDamienMcKenna
#79 metatag-n2564483-79.patch84.12 KBDamienMcKenna
#79 metatag-n2564483-79.interdiff.txt6.38 KBDamienMcKenna
#78 metatag-n2564483-78.patch83.82 KBDamienMcKenna
#78 metatag-n2564483-78.interdiff.txt568 bytesDamienMcKenna
#76 metatag-n2564483-76.patch83.92 KBDamienMcKenna
#76 metatag-n2564483-76.interdiff.txt9.41 KBDamienMcKenna
#73 metatag-n2564483-73.interdiff.txt26.16 KBDamienMcKenna
#73 metatag-n2564483-73.patch77.31 KBDamienMcKenna
#71 drupal_metatag.20151015_131817.tar_.gz6.39 MBdrupov
#69 metatag-n2564483-69.patch65.04 KBDamienMcKenna
#68 metatag-n2564483-68.interdiff.txt3.14 KBDamienMcKenna
#68 metatag-n2564483-68.patch54.88 KBDamienMcKenna
#67 metatag-n2564483-64.patch53.46 KBDamienMcKenna
#67 metatag-n2564483-64.interdiff.txt1.78 KBDamienMcKenna
#62 metatag-n2564483-62.patch54 KBDamienMcKenna
#60 metatag-n2564483-60.patch33.8 KBDamienMcKenna
#60 metatag-n2564483-60.interdiff.txt9.39 KBDamienMcKenna
#57 metatag-n2564483-57.patch33.96 KBDamienMcKenna
#57 metatag-n2564483-57.interdiff.txt7.17 KBDamienMcKenna
#56 metatag-n2564483-56.interdiff.txt2.99 KBDamienMcKenna
#56 metatag-n2564483-56.patch31 KBDamienMcKenna
#54 metatag-n2564483-54.interdiff.txt4.03 KBDamienMcKenna
#54 metatag-n2564483-54.patch30.63 KBDamienMcKenna
#53 metatag-n2564483-53.patch29.19 KBDamienMcKenna
#53 metatag-n2564483-53.interdiff.txt6.73 KBDamienMcKenna
#52 metatag-n2564483-52.patch29.56 KBDamienMcKenna
#52 metatag-n2564483-52.interdiff.txt760 bytesDamienMcKenna
#49 metatag-n2564483-49.interdiff.txt616 bytesDamienMcKenna
#49 metatag-n2564483-49.patch29.44 KBDamienMcKenna
#48 metatag-n2564483-48.patch29.51 KBDamienMcKenna
#48 metatag-n2564483-48.interdiff.txt9.74 KBDamienMcKenna
#45 metatag-n2564483-45-interdiff.txt5.33 KBDamienMcKenna
#45 metatag-n2564483-45.patch23.88 KBDamienMcKenna
#42 metatag-n2564483-42.patch22.55 KBDamienMcKenna
#41 metatag-n2564483-41.patch22.41 KBDamienMcKenna
#35 metatag-n2564483-35.patch19.64 KBDamienMcKenna
#31 metatag-n2564483-31.patch19.01 KBDamienMcKenna
#29 metatag-n2564483-29.patch19.1 KBDamienMcKenna
#27 metatag-n2564483-27.patch0 bytesDamienMcKenna
#25 metatag-n2564483-25.patch16.71 KBDamienMcKenna
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mas0h created an issue. See original summary.

mas0h’s picture

I also tried to refresh strings for metatag, but I got the following message:
Cannot refresh strings for Metatag.

DamienMcKenna’s picture

Try the latest -dev release, I changed the context used for the translation strings.

mas0h’s picture

I already tried the latest dev dated September 06, but the same result.

sylus’s picture

Priority: Normal » Major

Yeah I can confirm this as well on latest dev. Using Entity Translation with a token for dcterms.title: [node:title] | [site:name].

It will generate the token on both english + french but only the english ever shows. The functionality works as expected in metatag 1.4.

If i manually enter different text on the english + french dcterms.title that does work, just not tokens.

I am using latest dev with this issue: #2560649: Translate meta tags after tokens are replaced

sylus’s picture

Priority: Major » Normal

Actually sorry for the noise seems the issue I mentioned above resolves my issue. I am not sure it should be opt-in behavior but it does work! Bumping down priority.

DamienMcKenna’s picture

@mas0h: Can you please clarify what you're using for the translations, and presuming you're using the i18n module, the exact version you're using.

mas0h’s picture

I'm using Internationalization 7.x-1.13, and I'm doing translation from the normal interface admin/config/regional/translate/i18n_string

DamienMcKenna’s picture

Version: 7.x-1.7 » 7.x-1.x-dev

.

DamienMcKenna’s picture

mas0h’s picture

So, is it fixed in the latest dev?

DamienMcKenna’s picture

I'm going to look into this today, I'll get back to you.

DamienMcKenna’s picture

mas0h’s picture

Is that supposed to fix my problem? As I understood it's how to make a custom module to translate things line contact page.
My question is, why do I need to do a custom module while the translation via translation interface was working normally after the last metatag updates?

This is a major change and you should have told us about that before we update, because right now I cannot roll back to previous version that was working fine with me because there were some database updates with your new versions of metatag.

Is there any way to roll back to previous versions of metatag-1.4?
Thanks.

DamienMcKenna’s picture

@mas0h: No, that was for my own review. I didn't get to look into this too far yet, but I'll be doing a lot of testing this coming week to make sure that the i18n integration is correct and will provide update scripts to fix existing sites.

I'm not entirely sure what changed or when it changed, and I'm not sure if I wrote a change notice for anything related either. I'm really sorry for the mess over this but I will fix it.

FYI because of a bug on d.o it's impossible to look for unpublished change notices: #2302003: Change records tabs for contrib projects link to Drupal core's change records

mas0h’s picture

Good, now can relax :)

DamienMcKenna’s picture

@mas0h: Would you please share with me an example record from the locales_source table that no longer translates? Thanks.

mas0h’s picture

This is one record from locales_source table that was translated and now is gone:

lid = xxx
location = metatag:node:listing:title
textgroup = metatag
source = [node:field-listing-year] [node:field-make]  in [node:field-city] - Reference: [node:nid] |  in [variable:site_slogan]
context = node:listing:title
version = 0

I also checked locales_target table and found an entry for this lid, these are the values for this row:

plid = 0
plural = 0
i18n_status = 0
l10n_status = 1
mas0h’s picture

After further investigation I found that the all tokens were translated but the text strings between them lost translation and cannot be translated again.

DamienMcKenna’s picture

Title: Cannot translate metatags after last update anymore. » Cannot translate metatags after last update anymore
DamienMcKenna’s picture

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

DamienMcKenna’s picture

So the problem appears to be that it runs i18n_string_translate() prior to outputting the strings, but it never announces the translations via i18n_string_update().

FYI this is related to #1986032: i18n support for Metatag submodules (Views, Context, Panels), where the i18n_string support was refactored to work better for the submodules.

DamienMcKenna’s picture

Priority: Normal » Critical
DamienMcKenna’s picture

I hope it isn't a silly question, but what's the benefit of using i18n_string in the first place? Wouldn't we have the same functionality just by wrapping the output in e.g. t($value, array(), array('context' => $metatag_name))? I'll be in #drupal-i18n most of the week, if anyone would be able to help work this out? Thanks.

DamienMcKenna’s picture

Status: Active » Needs review
FileSize
16.71 KB

A WIP patch I wanted to save to show some progress. Right now I'm working on making the global configurations translatable.

Status: Needs review » Needs work

The last submitted patch, 25: metatag-n2564483-25.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
0 bytes

Further progress - the configurations are now successfully translated.

DamienMcKenna’s picture

One notable change in #27 is that the configurations now include the current page's langcode as part of the cache ID.

DamienMcKenna’s picture

FileSize
19.1 KB

Of course if I don't build the patch correctly it's all for naught.

Status: Needs review » Needs work

The last submitted patch, 29: metatag-n2564483-29.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
19.01 KB

This fixes the unit tests.

Status: Needs review » Needs work

The last submitted patch, 31: metatag-n2564483-31.patch, failed testing.

DamienMcKenna’s picture

The i18n tests are failing because of missing test dependencies, so I've opened an issue with the testbot project (#2584815: Rebuild test dependencies for Metatag 7.x-1.x) that'll hopefully resolve this problem.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
19.64 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 35: metatag-n2564483-35.patch, failed testing.

DamienMcKenna’s picture

drupov’s picture

I just tested this the latest dev and the patch from #35 and the metatag strings sadly don't get translated.

They are listed on the translation interface and everything seems to be configured correctly, but they just don't get translated.

DamienMcKenna’s picture

@drupov: Yes, I'm not finished fixing it yet. ;)

DamienMcKenna’s picture

DamienMcKenna’s picture

FileSize
22.41 KB

Small improvements, have added another test file for just locale support.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
22.55 KB

Some fixes to the Locale tests.

Status: Needs review » Needs work

The last submitted patch, 42: metatag-n2564483-42.patch, failed testing.

drupov’s picture

Thanks for the update. Translations seem to work now, but as in #40 the source language of the metatag strings is the default language of the site and not the "Source language" definied in Multilingual settings -> Strings (mostly English).

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
23.88 KB
5.33 KB

All tests should now be green.

DamienMcKenna’s picture

@drupov: I've reopened #2587725: Source language of metatag strings changes to the default language of the site after looking into it a little bit. I'm confused why it's happening this way, the labels are passed through the t() function and should just work?

drupov’s picture

#45-patch is good. Thanks!

DamienMcKenna’s picture

FileSize
9.74 KB
29.51 KB

All of the tests are passing, and the homepage translations appear to work now.

DamienMcKenna’s picture

FileSize
29.44 KB
616 bytes

There's one test failing and I'm not sure why it fails.

Status: Needs review » Needs work

The last submitted patch, 49: metatag-n2564483-49.patch, failed testing.

DamienMcKenna’s picture

Still to do:

  • Make it translate default configurations provided by the hooks, right now they're not showing up on the translation page.
  • Translate strings for the submodules (Context, Panels, Views).
  • Translate the customized entity values.
  • Fix all tests.
DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
760 bytes
29.56 KB

This fixes the broken test.

DamienMcKenna’s picture

FileSize
6.73 KB
29.19 KB

Minor adjustments.

DamienMcKenna’s picture

FileSize
30.63 KB
4.03 KB

All exported configurations are now translated too.

Status: Needs review » Needs work

The last submitted patch, 54: metatag-n2564483-54.patch, failed testing.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
31 KB
2.99 KB

Fixed the tests and reordered it slightly so that now it tests for translation strings before one is manually inserted.

DamienMcKenna’s picture

FileSize
7.17 KB
33.96 KB

I split up the i18n tests into two methods - one for the default configurations, one for the custom configurations.

DamienMcKenna’s picture

Status: Needs review » Needs work
DamienMcKenna’s picture

Status: Needs work » Needs review
DamienMcKenna’s picture

FileSize
9.39 KB
33.8 KB

Some further refactoring.

DamienMcKenna’s picture

The todo list:

  • Make it translate default configurations provided by the hooks, right now they're not showing up on the translation page. Done.
  • Translate strings for the submodules (Context, Panels, Views).
  • Translate the customized entity values.
  • Fix all tests. Done.
DamienMcKenna’s picture

FileSize
54 KB

Metatag:Panels integration! Woot!

I've also refactored things a bit, including renaming the tests to be a little more consistent, and have split out the submodules' i18n tests into separate files.

DamienMcKenna’s picture

Note - I haven't written any tests for the Metatag:Panels integration yet.

sylus’s picture

Based on this issue I was curious if I should hold off on updating some sites to Metatag 1.7 until 1.8 comes out. Am I correct that all metatag translations are broken in this release and this is what this issue addresses? Sorry just looking for clarification before perform some upgrades.

sylus’s picture

Based on this issue I was curious if I should hold off on updating some sites to Metatag 1.7 until 1.8 comes out. Am I correct that all metatag translations are broken in this release and this is what this issue addresses? Sorry just looking for clarification before perform some upgrades. Appreciate all the work @DamienMcKenna.

DamienMcKenna’s picture

@sylus: Yes, if you're using i18n on a site with Metatag you should wait to update.

DamienMcKenna’s picture

FileSize
1.78 KB
53.46 KB

This updates the Panels integration to use the full handler name as multiple variants on the same page would have the same task & subtask strings.

DamienMcKenna’s picture

FileSize
54.88 KB
3.14 KB

Another small update, this time it only saves the meta tags if they were enabled.

DamienMcKenna’s picture

FileSize
65.04 KB

This should make the i18n functionality work for Metatag:Context and Metatag:Views too. Again, no tests yet, and there are some @todo items remaining, but it appears to work. Also, no interdiff because it's getting a little complicated at this point ;-)

DamienMcKenna’s picture

At this point all of the submodules have i18n functionality working, though they need tests, and the configurations (from admin/config/search/metatags) are translatable.

All that's left is dealing with the main {metatag} records for entities. The question is: how should these be handled? Any advice?

drupov’s picture

Status: Needs review » Needs work
FileSize
6.39 MB

Hm, I just tested #69 with only "Metatag: Panels" and "Metatag: Views" submodules enabled and it worked for the global metatag, for a node, for a page manager page and a views page.

However I enabled "Metatag: Context" on the site also and the views page stopped translating. Also the context page did not get translated. The global metatag, the node and the page manager page still worked.

I am attaching a "drush arb" dump of the site I tested this. There is a custom module printing the content of meta name="description", so that the translations are visible better/faster.

DamienMcKenna’s picture

Status: Needs work » Needs review

@drupov: Is the problem you're seeing with the Metatag:Context translations happening because the per-path definitions are overriding the Views or Panels page paths that you were testing? Or are the metatag_views or metatag_panels translations in admin/config/regional/translate/translate no longer showing because the Context saved? I have all three running concurrently and I can see strings for all three, plus global configurations.

DamienMcKenna’s picture

FileSize
77.31 KB
26.16 KB

This adds tests to the Metatag:Context-i18n integration, and refactors some things accordingly.

drupov’s picture

Is the problem you're seeing with the Metatag:Context translations happening because the per-path definitions are overriding the Views or Panels page paths that you were testing?

No, I am using different paths for all configurations in this test.

Or are the metatag_views or metatag_panels translations in admin/config/regional/translate/translate no longer showing because the Context saved?

The metatag_panels translations are showing, only the views translations are not. And yes, the views translations stopped working after "Metatag: Context" got enabled. But I just tested it on a new instance (but with #73) and it worked ok.

BTW, the Context translations started translating on my previous instance (the one from #71, with the patch from #69) after applying the patch from #73. I guess it's ok now.

I hope that helps.

DamienMcKenna’s picture

@drupov: Thanks, that does help.

DamienMcKenna’s picture

FileSize
9.41 KB
83.92 KB

This adds tests for the Views-based display. Woot.

DamienMcKenna’s picture

Just to confirm it, the patch in #76 is for making sure that meta tags still work on pages controlled by Views.

DamienMcKenna’s picture

FileSize
568 bytes
83.82 KB

A minor change from #76, this just reduces the amount of effort spent on cache clearing.

DamienMcKenna’s picture

FileSize
6.38 KB
84.12 KB

A minor change.

mas0h’s picture

Great work DamienMcKenna, I really appreciate your effort. I tried to apply the patch #79 with NetBeans IDE, but it said patch applied partially. Is this OK?

DamienMcKenna’s picture

@mas0h: Thanks. Is there any way to tell what parts of the patch didn't apply correctly? In my local testing it seemed to be changes to some of the submodule info files that failed, but the main module changes should be ok.

mas0h’s picture

I have no idea, I applied the patch against the latest dev release. How to know what parts failed? what are you using for applying patches?

DamienMcKenna’s picture

I use the following to apply patches:
curl [URL] | patch -p1

Does phpStorm show you files ending in .rej, e.g. metatag_views.info.rej? Those would contain details of which patch chunks failed.

mas0h’s picture

I don't know man, but I use NetBeans to apply patches, and there are no .rej files there.

chegor’s picture

Applied patch from #79 against the latest dev.
There are 2 problems after:
1)In class MetatagPanelsI18nTest - 'name' repeated
2)In class MetatagCoreWithViewsTest - a)'name' repeated b)'extends' repeated

drupov’s picture

Here are my results with latest dev and patch from #79

01:14:45 /var/www$ drush dl metatag --select
Choose one of the available releases for metatag:
 [0]  :  Cancel                                                 
 [1]  :  7.x-1.x-dev  -  2015-Oct-12  -  Development            
 [2]  :  7.x-1.7      -  2015-Jul-24  -  Supported, Recommended
1
Project metatag (7.x-1.x-dev) downloaded to /var/www/metatag.                                                [success]
Project metatag contains 17 modules: metatag_google_plus, metatag_context, metatag_opengraph, metatag_verification, metatag_mobile, metatag_dc_advanced, metatag_facebook, metatag_panels, metatag_twitter_cards, metatag_importer, metatag_app_links, metatag_devel, metatag_dc, metatag_views, metatag_opengraph_products, metatag_favicons, metatag.

01:14:53 /var/www$ cd metatag/  
 
01:14:56 /var/www/metatag$ patch -p1 < /home/dimitar/Desktop/metatag-n2564483-79.patch 
patching file metatag.i18n.inc
patching file metatag.inc
patching file metatag.info
patching file metatag.module
patching file metatag_context/metatag_context.admin.inc
patching file metatag_context/metatag_context.context.inc
patching file metatag_context/metatag_context.i18n.inc
patching file metatag_context/metatag_context.i18n.test
patching file metatag_context/metatag_context.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file metatag_context/metatag_context.info.rej
patching file metatag_context/metatag_context.module
patching file metatag_context/metatag_context.test
patching file metatag_panels/metatag_panels.i18n.inc
patching file metatag_panels/metatag_panels.i18n.test (copied from metatag_panels/metatag_panels.test)
patching file metatag_panels/metatag_panels.info
Hunk #1 FAILED at 3.
1 out of 1 hunk FAILED -- saving rejects to file metatag_panels/metatag_panels.info.rej
patching file metatag_panels/metatag_panels.module
patching file metatag_panels/metatag_panels.test
patching file metatag_views/metatag_views.i18n.inc
patching file metatag_views/metatag_views.i18n.test (renamed from tests/metatag.views.test)
patching file metatag_views/metatag_views.info
Hunk #1 FAILED at 9.
1 out of 1 hunk FAILED -- saving rejects to file metatag_views/metatag_views.info.rej
patching file metatag_views/metatag_views.module
patching file metatag_views/metatag_views.test
patching file metatag_views/metatag_views_plugin_display_extender_metatags.inc
patching file tests/metatag.helper.test
patching file tests/metatag.locale.test
patching file tests/metatag.node.test
patching file tests/metatag.term.test
patching file tests/metatag.unit.test
patching file tests/metatag.user.test
patching file tests/metatag.with_i18n.test
patching file tests/metatag.with_panels.test (renamed from tests/metatag.panels.test)
patching file tests/metatag.with_views.test (copied from tests/metatag.term.test)
patching file tests/metatag_test.metatag.inc
DamienMcKenna’s picture

@chegor: What do you mean by "problems"? Do the tests fail? Do you see problems with the tests or the page output? Thanks.

@drupov: Thanks for providing that detail - the info file changes failing makes sense because the files are different between what's in git vs what's in the dev snapshots.

chegor’s picture

No, that's not about running tests.
1)Phpstorm said in these places "Patched (with problems)".
2)After patch applied in these places in code I see something like

public static function getInfo() {
    return array(
      'name' => 'Metatag core tests for terms',
      'name' => 'Metatag core tests with Views',
      'description' => 'Test Metatag integration with the Views module.',
drupov’s picture

@DamienMcKenna: yes, sorry, with the latest checkout from git the patch applies perfectly

git clone --branch 7.x-1.x http://git.drupal.org/project/metatag.git
DamienMcKenna’s picture

I hope it isn't a silly question, but would anyone be upset if I were to remove all of the non-working i18n_strings -based translations of entity values (all of the values that get saved in the {metatag} table), and instead rely on the normal entity translation functionality for entities meta tags?

mas0h’s picture

I don't use entity translation, will this mean that I will have to install this module to do translate my strings?

DamienMcKenna’s picture

Status: Needs review » Needs work

Just to be clear, my comment in #90 was strictly about the entity string translations, translations on config / default / Panels / Views / Context would continue to work.

The question, then, is how translations for entity values should work? Right now it runs i18n_string() on the strings before they tokens are parsed, and then again (optionally) after the tokens are parsed. Is this ok? Should it be changed to only running after the tokens are parsed? Right now this doesn't fully work anyway, so will need further work.

Current bugs:

  • The i18n_string support doesn't send the strings for translation.
  • The i18n_string support for output tags uses the wrong function to trigger translations.
  • There isn't a separate i18n string object defined for output meta tags.
  • There's practically no technical way of telling what i18n strings there could be until a page is loaded, i.e. it may not be possible to use metatag_i18n_string_list() to get them all.

The worst part? Once we work out how it should work I'm not sure there'll be an easy way to update any of the existing translations, they may have to be re-entered :( That's still to-be-confirmed, but I am concerned about it.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
2.21 KB
85.09 KB

This updates the README.txt, removes an incorrect call to i18n_string_object_update(), and puts back in a call to i18n_string(). Output i18n still doesn't work though ;-)

DamienMcKenna’s picture

FileSize
1.15 KB
85.84 KB

Some minor improvement to the README.txt file.

jwilson3’s picture

Totally in favor of moving to entity translation. But I'm opinionated because we *always* use entity translation.

Functionally speaking, the big difference I can see is that i18n_strings method has one single UI for finding translations and adding them, and the entity translation way depends more on a translate dropbutton / tab / etc found on each entity being translated, thus no centralized place to enter translations and thus more clicky clicky in the UI (maybe theres a module for this?).

Aside from UX differences that are out of scope of being fixed by this issue, one addition problem that may be surmountable here is that sites currently using the string method would have to re-create translations using the entity way, so maybe the module could include an update script that checks for presence of entity_translate, and if present runs a migration inserting entities for existing strings, and removes those strings? Thinking about this again, maybe not a great method, because if the module isnt present things would simply break. Hrm... hard problem :(

jwilson3’s picture

Reading the last patch you're actually proposing maintaining both string and entity approaches for translation. Ok! Mindblown!

DamienMcKenna’s picture

@jwilson3: Yes, we've started down the road to supporting i18n_string and sites already use it, so we can't go back. I don't think it'll take much work to do at this point, just need to confirm how it's supposed to work.

DamienMcKenna’s picture

FileSize
97.54 KB
23.34 KB

This includes i18n_strings support for output tags. And more tests.

This still needs an update script to batch-create translations for all existing sites, but otherwise I think it's functionally complete.

Please test the heck out of it :-)

DamienMcKenna’s picture

Things to decide:

  • For the tag output, is it ok that the meta tags are only translated *after* the tokens are replaced, i.e. it works on the final output? This means that it is no longer possible to e.g. use different tokens for different locales.
  • Is the context value for meta tag output translations the way it should be done?
  • Are there any problems with the current implementation, gaps in the functionality or any bugs?
  • Is there anything else that can be improved?
  • Besides the current plan to finish the update script to trigger the batch scanning to collect all available translation strings, is there anything else which needs an update script?
  • Any other feedback?

Thanks!

mas0h’s picture

Applied the last patch #98 against latest dev October, 12. Again I cannot translate metatag strings, deleted old strings and re-saved content-type metatag form again, and visited translation interface again with the same result, I couldn't translate my strings. re-rolled to metatag-1.4, still not able to translate, but my old translations worked. I'm not touching this again until it's 100% safe and fixed.

Thank you for your hard work.

DamienMcKenna’s picture

@mas0h: So it seems that we need an update script to update meta tag configurations from the following structures:

lid = xxx
location = metatag:node:listing:title
textgroup = metatag
source = [node:field-listing-year] [node:field-make]  in [node:field-city] - Reference: [node:nid] |  in [variable:site_slogan]
context = node:listing:title
version = 0

to this:

lid = xxx
location = metatag:metatag_config:node:listing:title
textgroup = metatag
source = [node:field-listing-year] [node:field-make]  in [node:field-city] - Reference: [node:nid] |  in [variable:site_slogan]
context = metatag_config:node:listing:title
version = 0
DamienMcKenna’s picture

FileSize
7.13 KB
103.49 KB

I had to split out the i18n tests into separate files as it was taking too long to run the tests.

DamienMcKenna’s picture

@mas0h: Can you please let me know what sort of records you see in the {locales_source} table for items that are *not* configs, i.e. that have a different format than what you posted in #18?

DamienMcKenna’s picture

Issue summary: View changes

I've updated the issue summary with the latest details.

DamienMcKenna’s picture

FileSize
3.17 KB
105.55 KB

This adds translations to the other meta tag class types.

DamienMcKenna’s picture

FileSize
4.09 KB
108.55 KB

Don't bother trying to process meta tags on the submodules on admin pages and don't try running translations unless the 'admin page' option is enabled; making this change/fix because it was adding meta tag translations on the Metatag settings page(s).

DamienMcKenna’s picture

Issue summary: View changes
mas0h’s picture

I have other records for taxonomy terms like this:

location    = taxonomy:term:2598:name
textgroup = taxonomy
context    = term:2598:name
version    = 0

Also some for views like:

location    = views:listing_type:default:display_title
textgroup = views
context    = listing_type:default:display_title
version    = 0

And for metatag related records:

location    = metatag:metatag:node:281441:281441:title
textgroup = metatag
context    = metatag:node:281441:281441:title
version    = 1
location    = metatag:metatag:node:281441:281441:article:modified_time
textgroup = metatag
context    = metatag:node:281441:281441:article:modified_time
version    = 1
location    = metatag:metatag:node:281441:281441:article:published_time
textgroup = metatag
context    = metatag:node:281441:281441:article:published_time
version    = 1

and so on for the same node number with description, keywords, abstract.etc.

das-peter’s picture

I couldn't review as much as I liked but here's a first feedback:

For the tag output, is it ok that the meta tags are only translated *after* the tokens are replaced, i.e. it works on the final output? This means that it is no longer possible to e.g. use different tokens for different locales.

Not sure if I understand it correctly. Would this mean that e.g. This is my sentence with a [token] couldn't be switched to Yoda stylez My sentence with a [token] this is? We should be able to "move around" tokens in a translation since the structure of sentences vary from language to language.
If a token is replace before translation wouldn't this make it impossible to use tokens in the translation itself? Me is a bit confused :)

Visual code review:

  1. +++ b/metatag.i18n.inc
    @@ -8,11 +8,109 @@
    +      // Table where the object is stored, to automate string lists
    ...
    +      // Table where the object is stored, to automate string lists
    
    +++ b/metatag_context/metatag_context.i18n.inc
    @@ -0,0 +1,64 @@
    +      // Table where the object is stored, to automate string lists
    
    +++ b/metatag_panels/metatag_panels.i18n.inc
    @@ -0,0 +1,64 @@
    +      // Table where the object is stored, to automate string lists
    
    +++ b/metatag_views/metatag_views.i18n.inc
    @@ -0,0 +1,64 @@
    +      // Table where the object is stored, to automate string lists
    

    Inline comments must end in full-stops, exclamation marks, or question marks.

  2. +++ b/metatag.module
    @@ -2377,16 +2445,18 @@ function metatag_translate_metatags(&$metatags) {
       global $language;
    

    Variable not used.

  3. +++ b/metatag_panels/metatag_panels.i18n.inc
    @@ -0,0 +1,64 @@
    +    'key' => 'did',
    +    // Placeholders for automatic paths. This connects the 'key' to strings in
    +    // the paths listed below.
    +    'placeholders' => array(
    +      '%did' => 'did',
    

    Wondering if we can / should use the uuid if available.
    A rebuild of exported displays could lead to a changed did and thus to orphaned translations.

  4. +++ b/metatag_views/metatag_views.i18n.inc
    @@ -0,0 +1,64 @@
    +    'title' => t('Metatag:Views configurations'),
    +    // The object key field.
    +    'key' => 'did',
    

    Isn't this a copy/paste artifact?

DamienMcKenna’s picture

FileSize
3.82 KB
108.56 KB

@das-peter: Thanks for the review.

tl;dr: Yes, strings are translatable before the tokens are parsed.

There are three different types of string translations currently available via the patch - configurations, the submodule custom integrations (Context, Panels, Views), and then finally the output. If a site has a global configuration set up via the defaults system at admin/config/search/metatags, then those will be translated when they're loaded on the page and before the per-entity values are loaded on top; this is usually where token-based values are set, so those will be translated correctly.

The one-off values that are entered in an entity (e.g. node) form are not translated until they're output on the final page. I did it this way because I suspect that most people are not switching from one token to another on a per-node basis, that instead they're filling in complete strings, so to translate both the pre-tokenized and post-tokenized strings would result in a *lot* of duplicates.

One additional question I have: should the per-entity translations be keyed off the revision ID as well as the entity ID, or just the entity ID? Or would it be better to offer an option on which is used?

I've fixed the first two items you noticed, thanks.

As for the hook_i18n_object_info() implementations, I was kinda guessing on how to make them work, it's likely I have something incorrect.

DamienMcKenna’s picture

FileSize
28.75 KB
113.59 KB

This includes some refactoring and improvements:

  • The metatag.api.php file has been reordered, slightly, and I added a few more comments.
  • All hook_i18n_string_list() implementations have been moved to the corresponding i18n.inc file.
  • I've restructured metatag.module slightly so all of the translation functions are at the end.
  • metatag_update_translations() has been renamed to metatag_translations_update().
  • metatag_translations_delete() has been added.
  • i18n_string_metatag_config_delete() to delete translation strings when config objects are deleted.
  • ICBW, but there may not have been anything actually triggering hook_metatag_config_delete(). This should be fixed now.

All existing questions still remain.

DamienMcKenna’s picture

FYI, one thing I'm trying to do in relation to this is work out how to handle Smartling integration (#2604884: i18n_string support?), I'm hoping I won't have to change the i18n integration further because of it.

DamienMcKenna’s picture

FileSize
115.76 KB

Rerolled.

DamienMcKenna’s picture

FileSize
115.73 KB

Rerolled again.

pwiniacki’s picture

GREAT job. I did test previous patches - working well

Notice: Undefined index: group in metatag_i18n_object_info() (line 99 of \sites\all\modules\metatag\metatag.i18n.inc).

and now I did test last one from #114 - all seems to be OK. You can drop 'Localized global Meta tags' module now (big thanks for author). Damien you are very active and talented maintainer - big thanks for you and rest of you who fix this.

Tested with stable version of: Domain Variable, Domain Access, i18n, variable + metatag with a patch.

DamienMcKenna’s picture

Status: Needs review » Needs work

Based upon experience on a large site, something needs to be refactored as the string updating via admin/config/regional/translate/i18n_string can fail on a site with lots of supported object configurations.

If anyone has any idea on how to what to do when hook_i18n_string_list times out, please let me know.

Status: Needs work » Needs review
sylus’s picture

I am interested in why hook_i18n_strings_list timeouts. I don't see much difference in logic with how other modules use hook_i18n_string_list particulatly for i18n panels which has big objects to import and does roughly the same thing. Though the second link is interesting as shows how their invocation uses drupal_static before the call to ctools_include('export') and ctools_export_crud_load_all.

http://cgit.drupalcode.org/panels/tree/i18n_panels/i18n_panels.module#n302
http://cgit.drupalcode.org/panels/tree/i18n_panels/i18n_panels.module#n375

As an aside I was wondering about the following line under the hook

if ($group == 'metatag' || $group == 'all') {

Should we only need to check if the group is metatag? I guess we need to check from all the groups?

DamienMcKenna’s picture

@sylus: It seems like all occurrences of hook_i18n_string_list would have the potential to time out on sites with lots of displays. On this one site I'm working with there are several hundred Panels variants spread across dozens of Panels pages.

That code is correct - when someone doesn't select a specific group to process it is supposed to process all of them by setting $group to 'all'.

DamienMcKenna’s picture

FYI while I've been redoing the translation functionality to use the object system, one UX improvement I've added is 'translate' subpages for the configuration system.

sylus’s picture

Ah thanks for the clarification. I see what you mean now I wasn't able to get a time out but I also don't have several hundred panel variants. Excited to get this patch in but not really sure either how to resolve those time out issues your experiencing.

sylus’s picture

Is that the only issue holding up this release?

I unfortunately did upgrade a few sites to metatag v1.7 and don't want to resort to checking out a git hash in my makefile to apply the patch.

Though the current patch does work great and resolves my issues.

I'd be happy to help however I can :)

DamienMcKenna’s picture

Status: Needs review » Needs work

There are a few @todo notes in the codebase, and in my latest WIP patch, and I need to talk to someone in the #drupal-i18n IRC channel about how to implement this properly, because my current effort isn't finding the strings.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
11.56 KB
118.97 KB

WIP to change to using hook_i18n_string_objects() instead of hook_i18n_string_list(). It also adds a new Translate page for configurations.

Status: Needs review » Needs work

The last submitted patch, 124: metatag-n2564483-124.patch, failed testing.

webflo’s picture

Status: Needs work » Needs review
FileSize
575 bytes
124.28 KB

Status: Needs review » Needs work

The last submitted patch, 126: 2564483-126.patch, failed testing.

DamienMcKenna’s picture

Todo list:

  1. Finish rewriting the submodule handling to use the 'list callback' instead of hook_i18n_string_object.
  2. Add translations of the {metatag} table, maybe with an on-off switch.
  3. Separate the existing output translations to a new type, to avoid confusion with the table records.
  4. Finish off the update scripts.
  5. Any @todo items that are left.
DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
119.08 KB
10.42 KB

WIP that I don't want to loose. The main configs now load metatag_i18n_list_configs, a 'list callback' instead of hooks.

Status: Needs review » Needs work

The last submitted patch, 129: metatag-n2564483-129.patch, failed testing.

The last submitted patch, 129: metatag-n2564483-129.patch, failed testing.

The last submitted patch, 129: metatag-n2564483-129.patch, failed testing.

sylus’s picture

Just wanted to chime in and say I really appreciate all your work on this @DamienMcKenna!

DamienMcKenna’s picture

This fixes the 12 failing tests and improves the docblocks in the metatag.inc file.

pwiniacki’s picture

patch applied partially, working good. Gonna test it in some live environment soon. Agree with @sylus.

sylus’s picture

I have tried the latest patch and all seems good as well. Still checking some integrations with tokens and panels but don't see the problems that created this issue.

Think this is the only blocker for next metatag release. I'll try to post some of the areas I tested within a few hours.

DamienMcKenna’s picture

Status: Needs review » Needs work

FYI the submodule configurations are being re-done.

ptkobe’s picture

I've applied the #134 patch to the git repo and I got pretty much everything I needed: translate strings works fine now, I could translate every meta tag, and even the multi-language front page is ok. The existent meta tags from 7x-1.7 were kept. So, thank you, Damien, a lot.

The only glitch I noticed was that if I have a [site-name] with a character that is outputted as "&#039;" to the html source, and if I use [site-name] in a, say, og: meta tag, that tag gets to the html source as "&amp;#039;".

EDIT: It was the #134 patch, not #124.

DamienMcKenna’s picture

@ptkobe: So it's double encoded?

ptkobe’s picture

Yes, exactly, I suppose.

DamienMcKenna’s picture

This version finishes implementing the metatag_i18n_translate_output variable to control whether the output tags are made available for translation, and fills in the update script to convert existing meta tag translations.

DamienMcKenna’s picture

This adds some initial tests for using Panels for node_view displays.

DamienMcKenna’s picture

Todo list update:

  • Not done yet: Finish rewriting the submodule handling to use the 'list callback' instead of hook_i18n_string_object.
  • Decided not to do this: Add translations of the {metatag} table, maybe with an on-off switch.
  • Done: Separate the existing output translations to a new type, to avoid confusion with the table records.
  • Done: Finish off the update scripts.
  • Not done yet: Any @todo items that are left.
DamienMcKenna’s picture

Status: Needs review » Needs work

@ptkobe: Ok, I can confirm that. Bother. Guess I'll have to fix it ;)

DamienMcKenna’s picture

Status: Needs work » Needs review
Related issues: +#2180031: Metatag displays "&#039;" instead of apostrophe in meta title tag
DamienMcKenna’s picture

I've fixed the double-encoding bug in #2180031, now back to the main event.

ptkobe’s picture

Applied metatag-n2180031-14.patch and it solved the double encoding on #134.

I guess I should say that I'm testing only for meta tags on pages with multi-lingual support (not for panels or views, context, admin pages, etc...).

patch at https://www.drupal.org/files/issues/metatag-n2180031-14.patch

lmeurs’s picture

We started using the Metatags module on a multilingual project more extensively just recently. Nodes are being content translated using i18n 7.x-1.13.

This seems to work just fine for nodes and views pages, but not for the front page node which always shows the metatag texts like title and description in the default language. NB: It only happens when the path only exists out of the language prefix as in /nl, not when the path is the full alias to the translated front page node as in /nl/my-front-page.

I tried the dev version if Metatags patched with patch from #142, ran database updates and cleared all caches, unfortunately no changes.

Is what we are experiencing related to this issue? Thanks a lot for all the great work!

DamienMcKenna’s picture

@lmeurs: Please describe how your front page nodes are set up - are you using Entity Translation or Content Translation, are you using the same nid for each version of the front page or do they have different nids, are you using the "front page" configuration from admin/config/search/metatag or the node's values?

lmeurs’s picture

@DamienMcKenna: Thanks for the quick response! The culprit appeared to be the same node ID for both languages. Since the front page only shows blocks and no node content we did not notice this any earlier... After changing the settings everything worked out fine with the latest stable version of Metatags. My apologies for the noise and so many thanks.

DamienMcKenna’s picture

@lmeurs: No problem, thanks for chiming in.

rodarc’s picture

We are using Panels Everywhere and have encountered a serious issue with using current_path() in the string context.

As Panels handle all the page views on the site a new string context is created for every unique url on the site.
This has led the translation table to grow out of control to 1 million+ rows.

We have a lot of entities passing through the site every day so we have a lot of unique urls that only last for a short time before being replaced by others.

function metatag_translate_metatag($string, $tag_name, $context = 'metatag', $langcode = NULL, $update = TRUE) {
-
-
-
-
  if (is_array($context)) {
      $new_context = 'metatag:';
      if (drupal_is_front_page()) {
        $new_context .= 'frontpage';
      }
      // If this is an entity page, use the entity as the context.
      elseif (!empty($context['entity_type']) && !empty($context['entity'])) {
        list($entity_id, $revision_id, $bundle) = entity_extract_ids($context['entity_type'], $context['entity']);
        $new_context .= $context['entity_type'] . ':' . $entity_id . ':' . $revision_id;
      }
      // Otherwise, use the page URL.
       else {
         $new_context .= 'page:' . current_path();
      }

      $context = $new_context;
    }
-
-
-
}
DamienMcKenna’s picture

@rodarc: That's an interesting issue. For your scenario, what would you suggest doing here? Maybe add a hook for custom modules to work out a context to use?

rodarc’s picture

Thanks for your quick reply.

I think that a hook would be a good solution.

DamienMcKenna’s picture

This adds hook_metatag_i18n_context_alter() which lets the string's $context be altered before it's passed in, and if the string is erased then it won't be translated.

DamienMcKenna’s picture

Status: Needs review » Needs work

Still needs work on the submodules.

DamienMcKenna’s picture

This is a WIP to rewrite the submodule handling using the new list/load structure. It doesn't work yet and I'm starting to get concerned it might not work due to the use of CTools exportables.

DamienMcKenna’s picture

@webflo: How would you suggest handling the submodules? They all have the situation where they need to identify configs that are both exported and in the database, so the primary 'key' value wouldn't always be applicable? I've added both a 'list callback' and 'load callback', but it doesn't seem like the load callbacks are being triggered? Any suggestions? Thanks.

DamienMcKenna’s picture

Status: Needs review » Needs work

FYI the question in #58 is open to anyone who might have an answer, not just webflo :)

DamienMcKenna’s picture

Renamed the MetatagCoreWithI18nTest class to MetatagCoreWithI18nOutputTest, and other minuscule changes.

DamienMcKenna’s picture

Status: Needs work » Needs review
FileSize
517 bytes
134.31 KB

Forgot to update the info file.

DamienMcKenna’s picture

This adds assertResponse() calls for all drupalGet() and drupalPost() calls.

DamienMcKenna’s picture

DamienMcKenna’s picture

Status: Needs review » Needs work

Ok, so the remaining issues boil down to one thing: What's the best way of listing all objects that need translating, given I need to support exported configurations and not just records in the database? I've been digging through it but haven't been able to work it out yet. I'll be in IRC all week, if anyone would have some time to help me? Thanks.

DamienMcKenna’s picture

Moved the test files into a subdirectory of each submodule, and added a custom module to each for holding default configurations that will have tests written for them.

DamienMcKenna’s picture

This adds tests for a default/exported Panels page that contains three meta tags.

DamienMcKenna’s picture

DamienMcKenna’s picture

The Metatag:Panels tests work because they're only dealing with exported displays, which are triggered via metatag_panels_ctools_render_alter(), it doesn't (yet) test for existing records in the database that need parsing. Will work on that soon but also (still) need help getting that piece to work correctly.

DamienMcKenna’s picture

Status: Needs review » Needs work

Another problem: On the admin/config/regional/translate/i18n_string page, if you select "Clean up left over strings.", which is the default, strings saved by Metatag:Panels are removed.

DamienMcKenna’s picture

Another problem: On the admin/config/regional/translate/i18n_string page, if you select "Clean up left over strings.", which is the default, strings saved by Metatag:Panels are removed.

DamienMcKenna’s picture

This shows the problem - after the strings have been refreshed in MetatagPanelsI18nTest::setUp() by i18n_string_refresh_group('metatag') the Panels strings should be available, but they aren't.

Status: Needs review » Needs work

The last submitted patch, 171: metatag-n2564483-171.patch, failed testing.

The last submitted patch, 171: metatag-n2564483-171.patch, failed testing.

DamienMcKenna’s picture

With some help from Gabor Hojtsy and webflo in IRC I was able to get the Panels integration working.

Status: Needs review » Needs work

The last submitted patch, 174: metatag-n2564483-174.patch, failed testing.

The last submitted patch, 174: metatag-n2564483-174.patch, failed testing.

DamienMcKenna’s picture

Doh! I renamed one of the test classes but forgot to update another that extended from it.

DamienMcKenna’s picture

Status: Needs work » Needs review
DamienMcKenna’s picture

That's better :-)

DamienMcKenna’s picture

Now trying to make the Metatag:Views functionality to work.

DamienMcKenna’s picture

Working on a test Views page. Also, simplified the name of the test Panels page.

DamienMcKenna’s picture

The last submitted patch, 181: metatag-n2564483-181.patch, failed testing.

The last submitted patch, 181: metatag-n2564483-181.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 182: metatag-n2564483-182.patch, failed testing.

The last submitted patch, 182: metatag-n2564483-182.patch, failed testing.

DamienMcKenna’s picture

Continued work on the Metatag:Views integration.

Status: Needs review » Needs work

The last submitted patch, 187: metatag-n2564483-187.patch, failed testing.

The last submitted patch, 187: metatag-n2564483-187.patch, failed testing.

DamienMcKenna’s picture

This appears to fix the Metatag:Views integration!!!! :-D

DamienMcKenna’s picture

Anonymous’s picture

I manually tested the Metatag: Panels integration with #190 applied. Everything seemed to work as expected, however, I notice a lot of logging by i18n_string. They look like this:

Updated string metatag:metatag:page:recipes/overview:title for text group metatag:

On a busy site, this can cause a lot of unwanted overhead. I think it might be possible to disable the comments by adding 'watchdog' => FALSE to the $options array in metatag_translate_metatag() in metatag.module (or better yet, make it configurable):

    // Automatically create/update the {locales_source} record if one wasn't
    // found.
    $options = array(
      'update' => $update,
    );

Would that be the right spot to add it?

DamienMcKenna’s picture

@pjonckiere: Thanks for noticing that. This adds a new option to enable the watchdog logging, which is now disabled by default.

DamienMcKenna’s picture

This is the output when I run the tests locally:

20160107 10:39:49 > simpletest Metatag

Drupal test run
---------------

Tests to be run:
 - Metatag:Context tests, with i18n (MetatagContextI18nTest)
 - Metatag:Context tests (MetatagContextTest)
 - Metatag core tests for Locale (MetatagCoreLocaleTest)
 - Metatag core tests for nodes (MetatagCoreNodeTest)
 - Metatag core tests for string handling (MetatagCoreStringHandlingTest)
 - Metatag core tests for string handling w i18n (MetatagCoreStringHandlingWithI18nTest)
 - Metatag core tests for terms (MetatagCoreTermTest)
 - Metatag unit tests (MetatagCoreUnitTest)
 - Metatag core tests for users (MetatagCoreUserTest)
 - Metatag core tests with i18n: configs (MetatagCoreWithI18nConfigTest)
 - Metatag core tests with i18n: node (MetatagCoreWithI18nNodeTest)
 - Metatag core tests with i18n: output (MetatagCoreWithI18nOutputTest)
 - Metatag core tests with Panels (MetatagCoreWithPanelsTest)
 - Metatag core tests with Views (MetatagCoreWithViewsTest)
 - Metatag core tests for hreflang (MetatagHreflangTest)
 - Metatag:Panels i18n tests (MetatagPanelsI18nTest)
 - Metatag:Panels tests (MetatagPanelsTest)
 - Metatag:Views i18n tests (MetatagViewsI18nTest)
 - Metatag:Views tests (MetatagViewsTest)

Test run started:
 Thursday, January 7, 2016 - 10:40

Test summary
------------

Metatag:Context tests, with i18n 201 passes, 0 fails, 0 exceptions, and 52 debug messages
Metatag:Context tests 117 passes, 0 fails, 0 exceptions, and 29 debug messages
Metatag core tests for Locale 0 passes, 0 fails, and 0 exceptions
Metatag core tests for nodes 104 passes, 0 fails, 0 exceptions, and 23 debug messages
Metatag core tests for string handling 117 passes, 0 fails, 0 exceptions, and 15 debug messages
Metatag core tests for string handling w i18n 117 passes, 0 fails, 0 exceptions, and 15 debug messages
Metatag core tests for terms 36 passes, 0 fails, 0 exceptions, and 8 debug messages
Metatag unit tests 27 passes, 0 fails, and 0 exceptions
Metatag core tests for users 31 passes, 0 fails, 0 exceptions, and 7 debug messages
Metatag core tests with i18n: configs 164 passes, 0 fails, 0 exceptions, and 46 debug messages
Metatag core tests with i18n: node 118 passes, 0 fails, 0 exceptions, and 36 debug messages
Metatag core tests with i18n: output 85 passes, 0 fails, 0 exceptions, and 24 debug messages
Metatag core tests with Panels 54 passes, 0 fails, 0 exceptions, and 14 debug messages
Metatag core tests with Views 53 passes, 0 fails, 0 exceptions, and 13 debug messages
Metatag core tests for hreflang 0 passes, 0 fails, and 0 exceptions
Metatag:Panels i18n tests 69 passes, 0 fails, 0 exceptions, and 18 debug messages
Metatag:Panels tests 9 passes, 0 fails, 0 exceptions, and 1 debug message
Metatag:Views i18n tests 69 passes, 0 fails, 0 exceptions, and 18 debug messages
Metatag:Views tests 9 passes, 0 fails, 0 exceptions, and 1 debug message

Test run duration: 9 min 52 sec

(This is a total of 1377 test assertions! Woot!)

Anyone able to identify any problems with the patch, or missing use cases? I'd like to get this committed ASAP.

sylus’s picture

This is awesome, thanks so much @DamienMcKenna! Was there still the problem of "listing all objects that need translating"? Or was that solved?

DamienMcKenna’s picture

@sylus: This should cover everything, if it doesn't then please let me know.

sylus’s picture

I did a review of this, hope this helps! Again I can't say enough for all that you did! Looks like currently scenario 3 is failing but thinking to do with token handling? (Was unrelated issue)

git clone --branch 7.x-1.x http://git.drupal.org/project/metatag.git && patch -p1 < metatag-n2564483-193.patch

patching file README.txt
patching file metatag.admin.inc
patching file metatag.api.php
patching file metatag.i18n.inc
patching file metatag.inc
patching file metatag.info
patching file metatag.install
patching file metatag.module
patching file metatag_context/metatag_context.admin.inc
patching file metatag_context/metatag_context.context.inc
patching file metatag_context/metatag_context.i18n.inc
patching file metatag_context/metatag_context.info
patching file metatag_context/metatag_context.module
patching file metatag_context/metatag_context.test
patching file metatag_context/tests/metatag_context.i18n.test
patching file metatag_context/tests/metatag_context.test
patching file metatag_context/tests/metatag_context_tests.context.inc
patching file metatag_context/tests/metatag_context_tests.info
patching file metatag_context/tests/metatag_context_tests.module
patching file metatag_panels/metatag_panels.i18n.inc
patching file metatag_panels/metatag_panels.info
patching file metatag_panels/metatag_panels.module
patching file metatag_panels/metatag_panels.test
patching file metatag_panels/tests/metatag_panels.i18n.test
patching file metatag_panels/tests/metatag_panels.test
patching file metatag_panels/tests/metatag_panels_tests.info
patching file metatag_panels/tests/metatag_panels_tests.module
patching file metatag_panels/tests/metatag_panels_tests.pages_default.inc
patching file metatag_views/metatag_views.i18n.inc
patching file metatag_views/metatag_views.inc
patching file metatag_views/metatag_views.info
patching file metatag_views/metatag_views.module
patching file metatag_views/metatag_views.test
patching file metatag_views/metatag_views_plugin_display_extender_metatags.inc
patching file metatag_views/tests/metatag_views.i18n.test
patching file metatag_views/tests/metatag_views.test
patching file metatag_views/tests/metatag_views_tests.info
patching file metatag_views/tests/metatag_views_tests.module
patching file metatag_views/tests/metatag_views_tests.views_default.inc
patching file tests/metatag.helper.test
patching file tests/metatag.locale.test
patching file tests/metatag.node.test
patching file tests/metatag.panels.test
patching file tests/metatag.string_handling.test
patching file tests/metatag.string_handling_with_i18n.test
patching file tests/metatag.term.test
patching file tests/metatag.unit.test
patching file tests/metatag.user.test
patching file tests/metatag.views.test
patching file tests/metatag.with_i18n_config.test
patching file tests/metatag.with_i18n_node.test
patching file tests/metatag.with_i18n_output.test
patching file tests/metatag.with_panels.test
patching file tests/metatag.term.test
Hunk #1 FAILED at 1.
Hunk #2 succeeded at 14 (offset -7 lines).
Hunk #3 succeeded at 46 (offset -7 lines).
Hunk #4 FAILED at 64.
Hunk #5 FAILED at 75.
Hunk #6 FAILED at 99.
Hunk #7 FAILED at 111.
Hunk #8 succeeded at 177 (offset -7 lines).
5 out of 8 hunks FAILED -- saving rejects to file tests/metatag.term.test.rej
patching file tests/metatag_test.info
patching file tests/metatag_test.metatag.inc

time drush --root=/data/var/www updatedb

 Metatag  7039  Reload some meta tag caches.
 Metatag  7040  Fix robots meta tags that might have been broken when they were imported  from
                Nodewords.
 Metatag  7041  Rerun update 7018 that was fixed to run correctly when using Entity  Translation.
                This may take some time.
 Metatag  7100  Delete a deprecated variable and clear all Metatag caches.
 Metatag  7101  Update i18n strings for all meta tags to use the new format.
Do you wish to run all pending updates? (y/n): y
Performed update: metatag_update_7039                                                     [ok]
No robots meta tags need to be fixed.                                                            [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7041                                                     [ok]
Performed update: metatag_update_7100                                                     [ok]
Performed update: metatag_update_7101                                                     [ok]
Update 7040: No robots meta tags need to be fixed.                                     [status]
Update 7018: No {metatag} records needed to have the revision_id value fixed.    [status]
'all' cache was cleared.                                                                                             [success]
Finished performing updates.                                                                                   [ok]

drush --root=/data/var/www updatedb  0.53s user 0.07s system 1% cpu 56.821 total

Scenario 1 (Entity Translated Node with Workbench Moderation)

Node Edit

Title: Metatag Translation Testing
Language: EN
Body: Metatag Translation for Entity Translated Node
Moderation: Draft
Tokens:

  • Page Title: [node:title] | [site:name]
  • Description: [node:summary]
  • Robots: Prevents search engines from indexing this page.

Node View Draft

<meta name="description" content="Metatag Translation for Entity Translated Node" />
<meta name="robots" content="noindex" />
<meta name="dcterms.title" content="Metatag Translation Testing" />
<meta name="dcterms.description" content="Metatag Translation for Entity Translated Node ..." />
<meta name="dcterms.issued" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.modified" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />

Scenario 2 (Entity Translated Node with Workbench Moderation and Deploy Enabled)

Node Edit

Title: Metatag Translation Testing
Language: EN
Body: Metatag Translation for Entity Translated Node
Moderation: Published
Tokens:

  • Page Title: [node:title] | [site:name]
  • Description: [node:summary]
  • Robots: Prevents search engines from indexing this page.

Node Published (Source Site)

<meta name="description" content="Metatag Translation for Entity Translated Node" />
<meta name="robots" content="noindex" />
<meta name="dcterms.title" content="Metatag Translation Testing" />
<meta name="dcterms.description" content="Metatag Translation for Entity Translated Node ..." />
<meta name="dcterms.issued" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.modified" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<meta name="dcterms.subject" title="gccore" content="none" />

Node Published (Destination Site)

<meta name="description" content="Metatag Translation for Entity Translated Node" />
<meta name="robots" content="noindex" />
<meta name="dcterms.title" content="Metatag Translation Testing" />
<meta name="dcterms.description" content="Metatag Translation for Entity Translated Node ..." />
<meta name="dcterms.issued" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.modified" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<meta name="dcterms.subject" title="gccore" content="none" />

Scenario 3 (Entity Translated Node with French Translation added / Workbench Moderation)

Node Edit

Title: Metatag Traduction Testing
Language: FR
Body: Traduction Metatag pour Node Entité Traduit
Moderation: Published
Tokens:

  • Page Title: [node:title] | [site:name]
  • Description: [node:summary]
  • Robots: Prevents search engines from indexing this page.

Node Published (EN)

<meta name="description" content="Metatag Translation for Entity Translated Node" />
<meta name="robots" content="noindex" />
<meta name="dcterms.title" content="Metatag Translation Testing" />
<meta name="dcterms.description" content="Metatag Translation for Entity Translated Node ..." />
<meta name="dcterms.issued" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.modified" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<meta name="dcterms.subject" title="gccore" content="none" />

Node Published (FR)

<meta name="description" content="Traduction Metatag pour Node Entité Traduit fra" />
<meta name="robots" content="noindex" />
<meta name="dcterms.title" content="Metatag Traduction Testing" />
<meta name="dcterms.description" content="Traduction Metatag pour Node Entité Traduit ..." />
<meta name="dcterms.issued" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.modified" title="W3CDTF" content="2016-01-07" />
<meta name="dcterms.language" title="ISO639-2" content="fra" />
<meta name="dcterms.subject" title="gccore" content="null" />
sylus’s picture

Nevermind I forgot I was fiddling around with admin_language for an unrelated project and this was causing issues so removed it and the third scenario worked. Will continue some tests and post results here. Sorry for the false notice! I have adjusted my the 3rd scenario to reflect success.

Currently English + French Metatags with tokens seems to work both with Workbench Moderation and the Deploy + UUID + Services deploy paradigm.

I will start to take a look at Panels now.

sylus’s picture

Scenario 4 (Panel Page)

Panels Metatag Configuration

Tokens:

  • Page Title: [site:name]
  • Description: Metatag Panels Description
  • Keywords: Metatag Panels Keywords
  • Dublin Core Language: [current-page:language_default_value]

Panels Page (EN)

<meta name="description" content="Metatag Panels Description" />
<meta name="keywords" content="Metatag Panels Keywords" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<meta name="dcterms.subject" title="gccore" content="none" />
<meta name="dcterms.title" content=“Drupal WxT“ />

Note: Went to the Translate Interface screen and translated the english non tokens above. They all appeared properly and with given contexts.

Panels Page (FR)

<meta name="description" content="Balise meta description Panneaux" />
<meta name="keywords" content="Balise meta keywords Panneaux" />
<meta name="dcterms.language" title="ISO639-2" content="fra" />
<meta name="dcterms.subject" title="gccore" content="null" />
<meta name="dcterms.title" content=“WxT Drupal“ />
sylus’s picture

Scenario 5 (View)

Overrode Metatag Views Config @ admin/config/search/metatags/config/view

Tokens:

  • Page Title: [view:title] | [current-page:pager][site:name]
  • Description: [view:description]
  • Keywords: Metatag Views Keywords
  • Dublin Core Language: [current-page:language_default_value]

Views Page Display (EN)

<meta name="description" content="Views displays providing functionality to showcase the different WxT themes." />
<meta name="keywords" content="Metatag Views Keywords" />
<meta name="robots" content="follow, index, noindex" />
<meta name="dcterms.title" content="Most requested services and information" />
<meta name="dcterms.subject" title="gccore" content="none" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<title>Most requested services and information | Local Development</title>

Note: Went to the Translate Interface screen and translated the english non tokens above. They all appeared properly and with given contexts.

Views Page Display (FR)

<meta name="description" content="
Vues écrans fournissant des fonctionnalités de présenter les différents thèmes de WXT ." />
<meta name="keywords" content="Vues Mots-clés tag" />
<meta name="robots" content="follow, index, noindex" />
<meta name="dcterms.title" content="
La plupart des services et informations demandées" />
<meta name="dcterms.subject" title="gccore" content="none" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<title>
La plupart des services et informations demandées | développement local</title>
sylus’s picture

Everything seems to work on my local testing am now going to test on a site with lots of existing content but on initial evaluation haven't seen any regressions and everything is working as expected. This is awesome!

DamienMcKenna’s picture

@sylus: Thanks for all the testing, that's excellent news!

I'm going to test it on a rather large site I have access to, rather than just my local testbed, I'll post an update on how it goes.

sylus’s picture

So I ran a few more tests and one with a site with quite a few thousand nodes. This was from Metatag 7.x-1.4 -> 7.x-1.x (latest)

The following updates are pending:

metatag module :
  7036 -   Update variables to indicate which entities should be supported.
  7037 -   Clear the menu cache so the renamed Settings page will be picked up.
  7038 -   Manually enable all content types, vocabularies and the user entity to help  resolve issues from 1.5's architecture change.
  7039 -   Reload some meta tag caches.
  7040 -   Fix robots meta tags that might have been broken when they were imported  from Nodewords.
  7041 -   Rerun update 7018 that was fixed to run correctly when using Entity  Translation. This may take some time.
  7100 -   Delete a deprecated variable and clear all Metatag caches.
  7101 -   Update i18n strings for all meta tags to use the new format.

Do you wish to run all pending updates? (y/n): y
Performed update: metatag_update_7036                                                     [ok]
Performed update: metatag_update_7037                                                     [ok]
Performed update: metatag_update_7038                                                     [ok]
Performed update: metatag_update_7039                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7040                                                     [ok]
Performed update: metatag_update_7041                                                     [ok]
Performed update: metatag_update_7041                                                     [ok]
Performed update: metatag_update_7100                                                     [ok]
Performed update: metatag_update_7101                                                     [ok]
The way that Metatag tracks which entity types are compatible has changed. Please review  [status]
the Settings page to ensure that all of the entity types are enabled correctly.
Update 7040: 1034 records to examine.                                                     [status]
Update 7040: 0 records were fixed.                                                        [status]
Update 7018: 9 records to update.                                                         [status]
Update 7018: 1 records were updated.                                                      [status]
Update 7018: 9 records were updated.                                                      [status]
Finished performing updates.                                                              [ok]

real	0m25.384s
user	0m5.535s
sys	0m1.834s

I did maybe notice a regression to do with html entities? Though not sure if something else related but an untouched site has the following:

<meta name="description" content="Part 1 Introduction Getting startedUsing the Software System Requirements Installation Procedure How to get help with the software   " />
<meta name="dcterms.issued" title="W3CDTF" content="2013-12-16" />
<meta name="dcterms.title" content="Canadian Automated Export Declaration (CAED) 2016 Version 16.0 User Guide" />
<meta name="dcterms.creator" content="Government of Canada, Statistics Canada" />
<meta name="dcterms.description" content="Part 1 Introduction Getting startedUsing the Software System Requirements Installation Procedure How to get help with the software    ..." />

Metatag updated site:

<meta name="description" content="Part 1&amp;#13; &amp;#13; Introduction&amp;#13; &amp;#13; &amp;#13; Getting startedUsing the Software&amp;#13; System Requirements&amp;#13; Installation Procedure&amp;#13; How to get help with the software&amp;#13; &amp;#13; &amp;#13;  &amp;#13; &amp;#13;" />
<meta name="dcterms.issued" title="W3CDTF" content="2013-12-16" />
<meta name="dcterms.title" content="Canadian Automated Export Declaration (CAED) 2015 Version 15.0 User Guide" />
<meta name="dcterms.creator" content="Government of Canada, Statistics Canada" />
<meta name="dcterms.description" content="Part 1&amp;#13; &amp;#13; Introduction&amp;#13; &amp;#13; &amp;#13; Getting startedUsing the Software&amp;#13; System Requirements&amp;#13; Installation Procedure&amp;#13; How to get help with the software&amp;#13; &amp;#13; &amp;#13;  &amp;#13; &amp;#13;..." />
<meta name="dcterms.modified" title="W3CDTF" content="2016-01-08" />

Seems like carriage returns are being encoded or something? The token that fills out description is just simply a [node:summary].

DamienMcKenna’s picture

@sylus: Are you testing with the very latest dev release? I added a change recently to better handle encoding of HTML entities from tokens.

DamienMcKenna’s picture

@sylus: Either way, I suggest if the problem persists that we take the string encoding problems to a separate issue.

sylus’s picture

Yeah I am on the latest dev and can only reproduce this on metatag dev, pasting the following should allow you to reproduce:

<div class="mrgn-lft-md"><a href="#a1">Part 1</a></div>
<div class="mrgn-lft-xl mrgn-bttm-0"><a href="#a1-1">Introduction</a></div>
<div>
	<details class="wet-boew-prettify print-open mrgn-lft-lg"><summary class="mrgn-lft-sm"><a href="#a1-2">Getting started</a></summary>
		<ul>
			<li><a href="#a1-2-1">Using the Software</a></li>
			<li><a href="#a1-2-2">System Requirements</a></li>
			<li><a href="#a1-2-3">Installation Procedure</a></li>
			<li><a href="#a1-2-4">How to get help with the software</a></li>
		</ul>
	</details>
</div>
<div class="mrgn-lft-md mrgn-tp-0 mrgn-bttm-0"><a href="#a2">Part 2</a></div>
<div class="mrgn-lft-xl mrgn-bttm-0"><a href="#a2-1">How to create an export declaration</a></div>
<div class="mrgn-bttm-0">
	<details class="wet-boew-prettify print-open mrgn-lft-lg"><summary class="mrgn-lft-sm"><a href="#a2-2">General features</a></summary>
		<ul>
			<li><a href="#a2-2-1">Memorize section</a></li>
			<li><a href="#a2-2-2">Memorize section as default</a></li>
			<li><a href="#a2-2-3">Save Section</a></li>
		</ul>
	</details>
</div>

Your right though should be filed as a separate issue :) I'll try to see if can find the culprit before file one. Other then that on a large site everything was good. ^_^

sylus’s picture

I think I found the problem in this patch under metatag.inc for the following function:

  public function tidyValue($value) {
    // Specifically replace encoded spaces, because some WYSIWYG editors are
    // silly. Do this before decoding the other HTML entities so that the output
    // doesn't end up with a bunch of a-circumflex characters.
    $value = str_replace('&nbsp;', ' ', $value);

    +  // Convert any HTML entities into regular characters.
    +  $value = decode_entities($value);

    // Remove any HTML code that might have been included.
    $value = strip_tags($value);

I added back those lines that were removed by the patch and then the entities rendered as expected.

<meta name="description" content="Part 1 Introduction Getting startedUsing the Software System Requirements Installation Procedure How to get help with the software" />
<meta name="dcterms.title" content="Test" />
<meta name="dcterms.description" content="Part 1 Introduction Getting startedUsing the Software System Requirements Installation Procedure How to get help with the software  ..." />
sylus’s picture

Would you like me to reroll the patch is changes look okay? Hoping that potentially a new metatag could be released this upcoming week :)

DamienMcKenna’s picture

@sylus: I don't think a reroll is needed, I just need to test it on a site or two at work tomorrow and it should be good to go.

k_zoltan’s picture

I tested the latest patch, on a site with 800000+ nodes:

git clone --branch 7.x-1.x http://git.drupal.org/project/metatag.git && patch -p1 < metatag-n2564483-193.patch

Everything worked well.
Thanks for your efforts.

pwiniacki’s picture

I have tested it on page with Domain Access 7.x-3.11, Domain Variable 7.x-1.1 with few subdomains/multilingual pages. Patch applied partially to 7.x-1.7 metatag module.

admin/config/system/site-information (admin/structure/domain/variables all variables checked)

Meta description, Meta keywords are not available and cannot be translated. Also you can't chose email for different language version of your subdomains/domains. Front page, Error pages are working fine. Different node language Titles and Descriptions etc. are working fine.

DamienMcKenna’s picture

@pwiniacki: What are you using for the translations, where are you trying to translate them?

sylus’s picture

@pwiniacki said patch applied partially to 7.x-1.7? The patch shouldn't really apply at all since only really applies to 7.x-1.x. That is probably the problem as most of patch didn't apply.

Both of those meta tags can be translated and I have outlined scenario showing that they are.

The patch has an issue against latest dev but that is only for the test file:

patching file tests/metatag.term.test
Hunk #1 FAILED at 1.
Hunk #2 succeeded at 14 (offset -7 lines).
Hunk #3 succeeded at 46 (offset -7 lines).
Hunk #4 FAILED at 64.
Hunk #5 FAILED at 75.
Hunk #6 FAILED at 99.
Hunk #7 FAILED at 111.
Hunk #8 succeeded at 177 (offset -7 lines).
5 out of 8 hunks FAILED -- saving rejects to file tests/metatag.term.test.rej
patching file tests/metatag_test.info
patching file tests/metatag_test.metatag.inc

I think we just need:


    +  // Convert any HTML entities into regular characters.
    +  $value = decode_entities($value);

Added to metatag.inc for the tidyValue function.

pwiniacki’s picture

@DamienMcKenna admin/config/system/site-information (I'm using i18n and entity mix) but it should be done with Domain Meta Tags 7.x-1.x-dev

@sylus it doesn't matter if you use dev or stable, I try to change netbean and use git directly latter on and test it on clean drupal install.

DamienMcKenna’s picture

@pwiniacki: There may be limitations in Domain Meta Tags, it may need to be updated to handle i18n too; I suspect the problems you're seeing are outside of Metatag's scope.

pwiniacki’s picture

@DamienMcKenna got it, BTW there are two 'domain meta' modules:

https://www.drupal.org/project/domain_meta
https://www.drupal.org/project/domains_metatag

I'm using first one, but second is broken too. Normal sites are working fine, clean drupal install confirm that there is problem with integration between Metatag and any of the above modules so in multidomain configuration it's worthless (atm) to use any meta module.

@Damien Support one of the modules to better integrate with new metatag would be on you @todo list, and IF, any time soon? :)

  • DamienMcKenna committed 9461880 on 7.x-1.x
    Issue #2564483 by DamienMcKenna, drupov, mas0h, das-peter, pwiniacki,...
DamienMcKenna’s picture

Status: Needs review » Fixed

I gave this a try on a large site that extensively uses the Panels integration, and all appears to be working correctly.

Committed! Thank you all so much for your help and patience over the past few months as we worked through this!

DamienMcKenna’s picture

@pwiniacki: It'd be best to bring it up in their respective issue queues - I haven't had time to work on the Domain Access integration and can't comment on what anyone else has done.

k_zoltan’s picture

I also tried to apply the patch to the 1.7 version of the metatag module but that didn't worked

BUT

  • getting the dev version
  • apply patch #193
  • replace the metatag folder with the original
  • doing the DB update

This definitely works as it should.
Tested the module on 2 more instances in German language having 80000+ and 40000+ nodes.
I used Panels Metatags. Works like a charm. :)

mas0h’s picture

Am I missing something here? I applied patch #193 on the latest dev yesterday, did database update. And I'm still facing the same symptoms. Variables are translated correctly but text strings reverted to original language, tried to re-translate them with no success, no matter what I do, they are listed in the translation dashboard as not translated strings.

Any hint or explanation would be appreciated.

DamienMcKenna’s picture

@mas0h: If you applied patch 193 to the latest -dev release then it would have reverted the changes - patch 193 is already in the -dev release. Please just try the -dev release and let us know if you have any problems with it.

mas0h’s picture

I tried also with latest dev without patching, cleared all caches, ran update.php, and the same symptoms remain.

DamienMcKenna’s picture

@mas0h: Please just try v7.x-1.8, and make sure you clear all caches after running the db updates.

mas0h’s picture

OK, I will get back to you with results soon.
Thank you for your hard work on this.

mas0h’s picture

Again same result, I downloaded 1.8 version, cleaned all caches, and then db update, but there were no updates to do. Tokens are translated, but text strings are not.
Some background info about my case:

I was using version 1.6 and everything was OK, until I downloaded 1.7, then that started to happen, there were some database updates with 1.7.
I downloaded 1.6 again and replaced 1.7, and everything started to work normally again. so I reverted 1.6 module files only, not database version.

DamienMcKenna’s picture

@mas0h: Please open a new issue to discuss this so we can start with a fresh look at your setup. Thanks.

mas0h’s picture

I opened another issue here https://www.drupal.org/node/2652120

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.