Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Bug #62705 Page title and heading would not change when language was …

…switched with the language select.
  • Loading branch information...
commit 72326212820ca2bfa1f5fb431d61583cbf0f36d1 1 parent de1d46b
Jari Kanerva authored December 06, 2012
1  CHANGELOG
@@ -2,6 +2,7 @@ Changes since MODX 1.2.5
2 2
 [Feature] Ticket #62896 Added github tag to "About this MOD". To link to the MOD repo at github.
3 3
 [Fix] Ticket #62844 "Find and Delete" and "In-line Find and Delete was not translated.
4 4
 [Fix] nodeValue is deprecated, replaced with value.
  5
+[Fix] Bug #62705 Page title and heading would not change when language was switched with the language select.
5 6
 
6 7
 Changes since MODX 1.2.4
7 8
 [Fix] Removed php-installer as link attribute and added it as a tag in the actions group.
74  modx.prosilver.en.xsl
@@ -781,6 +781,8 @@ function changeLanguage(langCode)
781 781
 		applyLanguage(enStrings.split("\n"));
782 782
 	}
783 783
 	xslLanguage(langCode);
  784
+
  785
+	show_title(langCode);
784 786
 }
785 787
 
786 788
 function load_languages()
@@ -809,6 +811,68 @@ function load_language()
809 811
 	send('', host + currentLanguage + '.txt?rnd=' + cachernd);
810 812
 }
811 813
 
  814
+if (typeof document.getElementsByClassName != 'function')
  815
+{
  816
+	document.getElementsByClassName = function()
  817
+	{
  818
+		var elms = document.getElementsByTagName('*');
  819
+		var ei = new Array();
  820
+		for (i = 0; i < elms.length; i++)
  821
+		{
  822
+			if (elms[i].getAttribute('class'))
  823
+			{
  824
+				ecl = elms[i].getAttribute('class').split(' ');
  825
+				for (j = 0; j < ecl.length; j++)
  826
+				{
  827
+					if (ecl[j].toLowerCase() == arguments[0].toLowerCase())
  828
+					{
  829
+						ei.push(elms[i]);
  830
+					}
  831
+				}
  832
+			}
  833
+			else if (elms[i].className)
  834
+			{
  835
+				ecl = elms[i].className.split(' ');
  836
+				for (j = 0; j < ecl.length; j++)
  837
+				{
  838
+					if (ecl[j].toLowerCase() == arguments[0].toLowerCase())
  839
+					{
  840
+						ei.push(elms[i]);
  841
+					}
  842
+				}
  843
+			}
  844
+		}
  845
+		return ei;
  846
+	}
  847
+}
  848
+
  849
+function show_title(langCode)
  850
+{
  851
+	var sel_title = document.getElementById('title-' + langCode);
  852
+
  853
+	if (sel_title == null)
  854
+	{
  855
+		// A title in English is required.
  856
+		sel_title = document.getElementById('title-en')
  857
+
  858
+		if (sel_title == null)
  859
+		{
  860
+			// No title in English or the selected language.
  861
+			return;
  862
+		}
  863
+	}
  864
+
  865
+	var hide_title = document.getElementsByClassName('hide-title');
  866
+
  867
+	for (var i = 0; i < hide_title.length; i++)
  868
+	{
  869
+		hide_title[i].style.display='none';
  870
+	}
  871
+
  872
+	sel_title.style.display='inline';
  873
+	document.title = "phpBB MOD » " + sel_title.innerHTML;
  874
+}
  875
+
812 876
 /*****************
813 877
 * AJAX Functions *
814 878
 *****************/
@@ -1629,7 +1693,14 @@ function toggle_edit(o)
1629 1693
 		<div id="debug"></div>
1630 1694
 		<div id="wrap">
1631 1695
 			<div id="page-header">
1632  
-				<h1><span id="lang-h1">Installation instructions for</span> '<xsl:value-of select="$title" />' <span id="lang-V">version</span>&nbsp;<xsl:value-of select="$version" /></h1>
  1696
+				<h1>
  1697
+					<span id="lang-h1">Installation instructions for</span>
  1698
+					<span class="hide-title" lang="{@lang}"> '<xsl:value-of select="$title" />' </span>
  1699
+					<xsl:for-each select="mod:header/mod:title">
  1700
+						<span class="hide-title" lang="{@lang}" id="title-{@lang}" style="display: none;"> '<xsl:value-of select="current()" />' </span>
  1701
+					</xsl:for-each>
  1702
+					<span id="lang-V">version</span>&nbsp;<xsl:value-of select="$version" />
  1703
+				</h1>
1633 1704
 				<form method="post" action="" id="lang-selector" style="display: none;">
1634 1705
 				<fieldset class="nobg">
1635 1706
 					<label for="language"><span id="lang-slg">Select language:</span></label>&nbsp;<select id="language" name="language" onclick="load_languages()"><option value="en" selected="selected">English</option></select>
@@ -1668,6 +1739,7 @@ function toggle_edit(o)
1668 1739
 		</html>
1669 1740
 	</xsl:template>
1670 1741
 
  1742
+
1671 1743
 	<xsl:template name="give-header">
1672 1744
 		<fieldset>
1673 1745
 			<legend id="lang-atm">About this MOD</legend>

0 notes on commit 7232621

Please sign in to comment.
Something went wrong with that request. Please try again.