AnsweredAssumed Answered

[Patch] Spell Checker Language

Question asked by WhiteKnight on Jun 30, 2009
Latest reply on Jul 1, 2009 by WhiteKnight

Before spellchecking.properties is created the default is that enable spellchecking and enable auto spellchecking are both true and the language is null (not defaulted). I propose that instead the default locale is use to default the langauge.

 

Index: C:/Trevor/Spark/src/plugins/spelling/src/java/org/jivesoftware/spellchecker/Spe llcheckerPreferences.java

===================================================================

--- C:/Trevor/Spark/src/plugins/spelling/src/java/org/jivesoftware/spellchecker/Spe llcheckerPreferences.java (revision 11081)

+++ C:/Trevor/Spark/src/plugins/spelling/src/java/org/jivesoftware/spellchecker/Spe llcheckerPreferences.java (working copy)

@@ -4,6 +4,7 @@

import java.io.FileInputStream;

import java.io.FileOutputStream;

import java.io.IOException;

+import java.util.Locale;

import java.util.Properties;

 

import org.jivesoftware.Spark;

@@ -47,7 +48,7 @@

     }

 

     public String getSpellLanguage() {

-       return props.getProperty("selectedSpellLanguage");

+       return props.getProperty("selectedSpellLanguage", Locale.getDefault().getLanguage());

     }

 

     public void setSpellCheckerEnabled(boolean enabled) {

Also could I suggest displaying the spellchecking language in the default locale:
Index: C:/Trevor/Spark/src/plugins/spelling/src/java/org/jivesoftware/spellchecker/Spe llcheckerPreferenceDialog.java
===================================================================
--- C:/Trevor/Spark/src/plugins/spelling/src/java/org/jivesoftware/spellchecker/Spe llcheckerPreferenceDialog.java (revision 11081)
+++ C:/Trevor/Spark/src/plugins/spelling/src/java/org/jivesoftware/spellchecker/Spe llcheckerPreferenceDialog.java (working copy)
@@ -45,7 +45,7 @@
for (int i = 0; i < languages.size(); i++) {
for (final Locale locale : locales) {
if (locale.toString().equals(languages.get(i))) {
-                 String label = locale.getDisplayLanguage(locale);
+                 String label = locale.getDisplayLanguage(Locale.getDefault());
                if (locale.getDisplayCountry(locale) != null &&
                    locale.getDisplayCountry(locale).trim().length() > 0) {
                    label = label + "-" + locale.getDisplayCountry(locale).trim();

Outcomes