Revision: 7888
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=7888&view=rev
Author:   dnaber
Date:     2012-08-19 19:48:56 +0000 (Sun, 19 Aug 2012)
Log Message:
-----------
select the default variant, thus making sure we provide spell checking if 
possible

Modified Paths:
--------------
    
trunk/ltcommunity/grails-app/controllers/org/languagetool/HomepageController.groovy
    trunk/ltcommunity/grails-app/views/homepage/checkText.gsp

Modified: 
trunk/ltcommunity/grails-app/controllers/org/languagetool/HomepageController.groovy
===================================================================
--- 
trunk/ltcommunity/grails-app/controllers/org/languagetool/HomepageController.groovy
 2012-08-19 19:44:46 UTC (rev 7887)
+++ 
trunk/ltcommunity/grails-app/controllers/org/languagetool/HomepageController.groovy
 2012-08-19 19:48:56 UTC (rev 7888)
@@ -113,6 +113,9 @@
             langStr = params.lang
         }
         Language lang = Language.getLanguageForShortName(langStr)
+        if (lang.hasVariant()) {
+            lang = lang.getDefaultVariant()   // we need to select a variant 
because we want spell checking
+        }
         JLanguageTool lt = new JLanguageTool(lang)
         lt.activateDefaultPatternRules()
         List userRules = getUserRules()

Modified: trunk/ltcommunity/grails-app/views/homepage/checkText.gsp
===================================================================
--- trunk/ltcommunity/grails-app/views/homepage/checkText.gsp   2012-08-19 
19:44:46 UTC (rev 7887)
+++ trunk/ltcommunity/grails-app/views/homepage/checkText.gsp   2012-08-19 
19:48:56 UTC (rev 7888)
@@ -50,8 +50,10 @@
                 <select name="lang">
                     <g:each in="${languages}" var="lang">
                         <g:set var="codeWithCountry" 
value="${lang.countryVariants?.size() == 1 && lang.countryVariants[0] != 'ANY' 
? lang.shortName + '-' +lang.countryVariants[0] : lang.shortName}"/>
-                        <g:set var="selected" value="${params.lang == 
codeWithCountry ? 'selected' : ''}"/>
-                        <option ${selected} 
value="${codeWithCountry}">${lang.name}</option>
+                        <g:set var="selected" 
value="${language.getShortNameWithVariant() == codeWithCountry ? 'selected' : 
''}"/>
+                        <g:if test="${!lang.hasVariant()}">
+                            <option ${selected} 
value="${codeWithCountry}">${lang.name}</option>
+                        </g:if>
                     </g:each>
                 </select>
             </g:form>

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-cvs mailing list
Languagetool-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs

Reply via email to