Skip to content

Commit 8cdf5c7

Browse files
Merge pull request #34204 from vikram-redhat/l10n
testing l10n links
2 parents 1124b9e + 489eb54 commit 8cdf5c7

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

_javascripts/page-loader.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,34 @@ function versionSelector(list) {
4848

4949
}
5050

51+
// checks what language was selected and then sends the user to the portal for their localized version
52+
function selectLang(langList) {
53+
54+
var lang = langList[langList.selectedIndex].value;
55+
var winPath = window.location.pathname;
56+
57+
console.log("Lang: " + lang);
58+
console.log("Win Path: " + winPath);
59+
60+
var currentVersion = document.getElementById("version-selector").value;
61+
// var currentVersion = "4.7";
62+
console.log("CurrentVersion: " + currentVersion);
63+
64+
// path for the file to reference on portal (the last bit removes .html)
65+
var path = winPath.substring(winPath.lastIndexOf(currentVersion) + currentVersion.length, winPath.length - 5);
66+
67+
console.log("Path: " + path);
68+
69+
var portalBaseURL = "https://access.redhat.com/documentation";
70+
var finalURL = portalBaseURL + "/" + lang + "/openshift_container_platform/" + currentVersion + "/html/" + path;
71+
72+
console.log("Final URL: " + finalURL);
73+
74+
// alert(finalURL);
75+
window.location.href = finalURL;
76+
77+
}
78+
5179
// sets the current version in the drop down and sets up suggest an edit options
5280
function selectVersion(currentVersion) {
5381

_templates/_page_openshift.html.erb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@
9696
((distro_key == "openshift-dedicated") ? "[dedicated] Issue in file #{repo_path}" : "[online] Issue in file #{repo_path}") %>">
9797
Open an issue
9898
</a>
99+
<% if (version == "4.5") %>
100+
/
101+
<select onchange="selectLang(this);">
102+
<option value="en-us">English</option>
103+
<option value="zh-cn">简体中文</option>
104+
<option value="ja-jp">日本語</option>
105+
</select>
106+
<% end %>
99107
<% end %>
100108
</span>
101109
<% end %>

0 commit comments

Comments
 (0)