Hi,

Eike Rathke from LibreOffice mailed me, asking me to remove the occurrences of the "ANY" language/country code in LT, as it isn't a valid BCP 47 code. A first test (see attached patch) reveals no problems. Does anybody see a problem with removing the "ANY" code? Any idea why it was introduced in the first place?

Regards
 Daniel

--
http://www.danielnaber.de
Index: languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java	(date 1384892700000)
+++ languagetool-office-extension/src/main/java/org/languagetool/openoffice/Main.java	(revision )
@@ -534,14 +534,17 @@
       final Locale[] aLocales = new Locale[dims];
       int cnt = 0;
       for (final Language element : Language.LANGUAGES) {
+        if (element.getCountries().length == 0) {
+          // e.g. Esperanto
+          aLocales[cnt++] = new Locale(LIBREOFFICE_SPECIAL_LANGUAGE_TAG, null, element.getShortNameWithCountryAndVariant());
+        }
         for (final String country : element.getCountries()) {
           if (element.getVariant() != null) {
-            aLocales[cnt] = new Locale(LIBREOFFICE_SPECIAL_LANGUAGE_TAG, country, element.getShortNameWithCountryAndVariant());
+            aLocales[cnt++] = new Locale(LIBREOFFICE_SPECIAL_LANGUAGE_TAG, country, element.getShortNameWithCountryAndVariant());
           }
           else {
-            aLocales[cnt] = new Locale(element.getShortName(), country, "");
+            aLocales[cnt++] = new Locale(element.getShortName(), country, "");
           }
-          cnt++;
         }
       }
       return aLocales;
Index: languagetool-office-extension/src/main/resources/Linguistic.xcu
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- languagetool-office-extension/src/main/resources/Linguistic.xcu	(date 1384892700000)
+++ languagetool-office-extension/src/main/resources/Linguistic.xcu	(revision )
@@ -8,7 +8,7 @@
 			<node oor:name="org.languagetool.openoffice.Main"
 				oor:op="fuse">
 				<prop oor:name="Locales" oor:type="oor:string-list">
-					<value>en-ANY de-LU de-LI de-BE pl-PL fr-FR fr fr-BE fr-CH fr-CA fr-LU fr-MC fr-CM fr-CI fr-HI fr-ML fr-SN fr-CD fr-MA fr-RE es-ES es es-MX es-GT es-CR es-PA es-DO es-VE es-PE es-AR es-EC es-CL es-UY es-PY es-BO es-SV es-HN es-NI es-PR es-US es-CU it-IT it-CH km-KH nl-NL nl-BE lt-LT uk-UA ru-RU sk-SK sl-SI sv-SE sv-FI ro-RO is-IS gl-ES ca-ES ca-ES-valencia da-DK ml-IN be-BY eo-ANY zh-CN ast-ES tl-PH br-FR el-GR en-US en-GB en-CA en-ZA en-NZ en-AU de-DE de-AT de-CH pt-AO pt-MZ pt-PT pt-BR ja-JP</value>
+					<value>en de-LU de-LI de-BE pl-PL fr-FR fr fr-BE fr-CH fr-CA fr-LU fr-MC fr-CM fr-CI fr-HI fr-ML fr-SN fr-CD fr-MA fr-RE es-ES es es-MX es-GT es-CR es-PA es-DO es-VE es-PE es-AR es-EC es-CL es-UY es-PY es-BO es-SV es-HN es-NI es-PR es-US es-CU it-IT it-CH km-KH nl-NL nl-BE lt-LT uk-UA ru-RU sk-SK sl-SI sv-SE sv-FI ro-RO is-IS gl-ES ca-ES ca-ES-valencia da-DK ml-IN be-BY eo zh-CN ast-ES tl-PH br-FR el-GR en-US en-GB en-CA en-ZA en-NZ en-AU de-DE de-AT de-CH pt-AO pt-MZ pt-PT pt-BR ja-JP</value>
 				</prop>
 			</node>
 		</node>
Index: languagetool-language-modules/en/src/main/java/org/languagetool/language/English.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- languagetool-language-modules/en/src/main/java/org/languagetool/language/English.java	(date 1384892700000)
+++ languagetool-language-modules/en/src/main/java/org/languagetool/language/English.java	(revision )
@@ -83,7 +83,7 @@
 
   @Override
   public String[] getCountries() {
-    return new String[]{"ANY"}; //?
+    return new String[]{};
   }
   
   @Override
Index: languagetool-language-modules/eo/src/main/java/org/languagetool/language/Esperanto.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- languagetool-language-modules/eo/src/main/java/org/languagetool/language/Esperanto.java	(date 1384892700000)
+++ languagetool-language-modules/eo/src/main/java/org/languagetool/language/Esperanto.java	(revision )
@@ -73,8 +73,7 @@
 
   @Override
   public String[] getCountries() {
-    /* return "ANY" country code as a "country-less" placeholder for OOo: */
-    return new String[] {"ANY"};
+    return new String[]{};
   }
   
   @Override
Index: languagetool-language-modules/ca/src/main/java/org/languagetool/language/Catalan.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- languagetool-language-modules/ca/src/main/java/org/languagetool/language/Catalan.java	(date 1384892700000)
+++ languagetool-language-modules/ca/src/main/java/org/languagetool/language/Catalan.java	(revision )
@@ -66,7 +66,7 @@
 
   @Override
   public String[] getCountries() {
-    return new String[]{"ANY"};
+    return new String[]{};
   }
   
   @Override
Index: languagetool-core/src/main/java/org/languagetool/Language.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- languagetool-core/src/main/java/org/languagetool/Language.java	(date 1384892700000)
+++ languagetool-core/src/main/java/org/languagetool/Language.java	(revision )
@@ -662,7 +662,7 @@
   }
 
   private boolean hasCountry() {
-    return getCountries().length == 1 && !(getCountries().length == 1 && getCountries()[0].equals("ANY"));
+    return getCountries().length == 1;
   }
 
   private static String listToStringWithLineBreaks(final Collection<String> l) {
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Languagetool-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to