Knowledgebase Home Page  >  RapidSpell Web Java
Search the Knowledge Base
How to allow the user to switch language from the popup.
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=260&catId=45

Options

Print this page
Email this to a friend

The following will add a select drop-down with language options, and assumes that you have the French and German dictionary (.dict) files in the root of the web application.  And that your spell check popup JSP is named RapidSpellCheckerPopUp.jsp

 

In the popup JSP (where you have the RapidSpellWeb:rapidSpellWeb tag), add the following code (eg below the rapidSpellWeb tag);

 

 

<script type='text/javascript'>

                                 function setLanguage(language, form){

                                     

                                     form.GuiLanguage.value=language;

                                     form.LanguageParser.value=language;

                                     if(language=="ENGLISH")

                                        form.DictFile.value="";

                                     if(language=="FRENCH")

                                        form.DictFile.value="~/DICT-FR-FR-French.dict";

                                     if(language=="GERMAN")

                                        form.DictFile.value="~/DICT-DE-DE-German.dict";                                   

                                 }

                             </script>

                             <form action="RapidSpellCheckerPopUp.jsp" method="POST">

                                 <%

                                 java.util.Enumeration paramNames = request.getParameterNames();

                                 String paramName;

                                 String paramValue;

                                while(paramNames.hasMoreElements())

                                {

                                      paramName = (String)paramNames.nextElement();

                                      paramValue = request.getParameter(paramName);                                        

                                 %>

                                    <input type="hidden" name="<%=paramName%>" value="<%=paramValue%>"/>

                                 <%}%>

                                 <select name='language' id="language" onchange="window.onunload=null;setLanguage(this.value, this.form);this.form.submit()">

                                     <option value="">Select language</option>

                                     <option value="ENGLISH">English</option>

                                     <option value="FRENCH">French</option>

                                     <option value="GERMAN">German</option>

                                    

                                 </select>

                         

                             </form>

 

 

You can easily expand upon this to include other languages/dictionaries.  Also, if you wanted to store the dictionaries in a subfolder off of the root called 'dictionaries' then you could and just change the code to

 

~/dictionaries/DICT-FR-FR-French.dict


Related Questions:

Attachments:

No attachments were found.