Topic on Project:Support desk

[Resolved] Adding global meta tag for Google Website Translator

1
Iantresman (talkcontribs)

Extension:MetaTags lets you add custom meta tags to individual pages. I needed to add a meta tag to all pages. I don't know whether this is the right way, or best way to do this.

Google Website Translator is a widget that embeds a drop down menu on each page, to let visitor select a language into which to translate the page (demo: see "4. Google Translate Bar"). The wizard creates a meta tag, and HTML snippet.

Using MedaiWiki 1.23.5, to add the meta tag, I added the following snippet to my LocalSettings.php file (first 4 lines already exist):

# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
	exit;
}

$wgExtensionFunctions[] = 'globalMetaGoogleXlate';
function globalMetaGoogleXlate(){
   global $wgOut;
   $wgOut->addMeta ( 'google-translate-customization' , 'cc5b9e13f99-4d62c779b7cf64cb-g83044656fb7362a2-13');
}

Adds the following meta tag in <head>..</head>

<meta name="google-translate-customization" content="cc5b9e13f99-4d62c779b7cf64cb-g83044656fb7362a2-13" />

To embed the generated snippet into my page (in my case, the Vector skin), I made a backup the files skins/Vector.php, and found a suitable location to add it.

Reply to "[Resolved] Adding global meta tag for Google Website Translator"