File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff 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
5280function selectVersion ( currentVersion ) {
5381
Original file line number Diff line number Diff line change 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 %>
You can’t perform that action at this time.
0 commit comments