Skip to content

Commit

Permalink
Item13831: improve js changing languages
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDaum committed Apr 12, 2016
1 parent 60e4125 commit 1bae448
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
21 changes: 10 additions & 11 deletions core/data/System/LanguageSelector.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1447730097" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1460446104" format="1.1" version="1"}%
%META:TOPICPARENT{name="TimeSpecifications"}%
---+!! Language selection dropdown

Expand All @@ -18,23 +18,22 @@ Result:
then="$percentINCLUDE{\"%TOPIC%\" section=\"selector\"}$percent"
}%%STOPINCLUDE%

<!-- %JQREQUIRE{"chili"}% <verbatim class="tml">
%STARTSECTION{"selector"}%<form name="changeLanguage"\
action="%SCRIPTURLPATH{"oops"}%/%BASEWEB%/%BASETOPIC%" method="get">
<verbatim class="foswikiHidden">
%STARTSECTION{"selector"}%<form action="%SCRIPTURLPATH{"oops"}%/%BASEWEB%/%BASETOPIC%" method="get">
<input type="hidden" name="redirectto" value="%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%?%QUERYPARAMS{encoding="url" separator=";"}%" />
<select name="language" class="foswikiSelect"\
onchange="document.changeLanguage.submit()">
<select name="language" class="foswikiSelect" onchange="this.form.submit()">
<option value='default'>%MAKETEXT{"Default"}%</option>
%LANGUAGES{
format="<option $marker value=\"$langtag\">$langname</option>"
format="<option $marker value='$langtag'>$langname</option>"
selection="%LANGUAGE%"
separator=" "
marker="selected=\"selected\""
marker="selected='selected'"
}%</select>
<input type="hidden" name="template" value="oopslanguagechanged" />
<noscript>
<input class="foswikiButton" type="submit"\
value="%MAKETEXT{"Change language"}%" />
<input class="foswikiButton" type="submit" value="%MAKETEXT{"Change language"}%" />
</noscript>
</form>%ENDSECTION{"selector"}%
</verbatim> -->
</verbatim>

%META:PREFERENCE{name="ALLOWTOPICVIEW" title="ALLOWTOPICVIEW" type="Set" value="*"}%
7 changes: 5 additions & 2 deletions core/templates/oopslanguagechanged.tmpl
Expand Up @@ -10,5 +10,8 @@

%TMPL:DEF{"webaction"}% *%MAKETEXT{"Attention"}%* %TMPL:END%

%TMPL:DEF{"message"}%%SESSION_VARIABLE{"LANGUAGE" set="%URLPARAM{language}%"}%
%MAKETEXT{"Your language has been changed to [_1]. ~[~[[_2]~]~[click to proceed~]~]." args="*%SESSION_VARIABLE{LANGUAGE}%*, %SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%"}%%TMPL:END%
%TMPL:DEF{"message"}%%IF{"$'URLPARAM{language}'='default'"
then="$percntSESSION_VARIABLE{\"LANGUAGE\" clear=\" \"}$percnt"
else="$percntSESSION_VARIABLE{\"LANGUAGE\" set=\"%URLPARAM{language}%\"}$percnt"
}%
%MAKETEXT{"Your language has been changed to [_1]. ~[~[[_2]~]~[click to proceed~]~]." args="*%URLPARAM{language}%*, %SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%"}%%TMPL:END%

0 comments on commit 1bae448

Please sign in to comment.