Hello community,

here is the log from the commit of package libreoffice-languagetool for 
openSUSE:11.3
checked in at Thu Mar 31 01:45:00 CEST 2011.



--------
New Changes file:

--- /dev/null   2010-08-26 16:28:41.000000000 +0200
+++ 11.3/libreoffice-languagetool/libreoffice-languagetool.changes      
2011-03-18 22:34:25.000000000 +0100
@@ -0,0 +1,173 @@
+-------------------------------------------------------------------
+Fri Mar 18 22:12:32 CET 2011 - [email protected]
+
+- maintenance update (bnc#667421, MaintenanceTracker-38738)
+
+-------------------------------------------------------------------
+Mon Mar  7 14:54:51 CET 2011 - [email protected]
+
+- fixed handling of the architecture dependant symlinks (bnc#677354)
+
+-------------------------------------------------------------------
+Sun Feb 13 21:48:13 CET 2011 - [email protected]
+
+- updated to version 1.2:
+    * updated rules and dictionaries for almost all languages
+    * major update of the French dictionary (bnc#569617)
+    * added new scripts testwikipedia.sh and testwikipedia.bat; these allow
+      to check a local Wikipedia XML dump; it helps to test new rules,
+      especially to avoid false alarms
+    * problem with salutation ending with comma and false alarm
+      for a missing uppercase letter (sf#2830181)
+    * incorrect line numbers for files larger than 64000 bytes (sf#3076989)
+    * SRX sentence tokenization rules for Catalan, Danish, German
+    * initial support for checking bilingual texts (bitexts), 
+    * fixed LT menu integration for OOo/LO 3.3.0 (i#114078)
+    * add tagger dictionary and synthesizer for Catalan
+    * incorrect ICU regex in SRX file (sf#2998138)
+    * do not show LT menu in Calc (sf#2972055)
+    * better deal with Windows line breaks
+    * initial support for OOo help system
+    * footnote numbers before a comma
+    * add synthesizer for Spanish
+    * updated the morfologik-stemming library to version 1.4.0
+        * performance improvements
+        * ability to build the binary automata directly from Java
+- updated script to generate part of the spec file
+- added Catalan dictionary
+
+-------------------------------------------------------------------
+Thu Feb  3 21:07:21 CET 2011 - [email protected]
+
+- renamed from OpenOffice_org-LanguageTool to libreoffice-languagetool
+- installed unpacked extension into the newly preferred prefix
+  /usr/share/libreoffice/share/extensions/ 
+- removed obsolete postinstall scripts that registered the extensions;
+  instead linked the directory to /usr/lib(64) where it is found and
+  registered automatically
+- added unzip into BuildRequires to install unpacked extension
+
+-------------------------------------------------------------------
+Thu Mar 25 20:52:41 CET 2010 - [email protected]
+
+- replaced "Other uncritical OpenSource License" with CCA-SA2.0; CCA-SA3.0;
+  in the License tag of the main package
+
+-------------------------------------------------------------------
+Thu Mar 18 21:03:50 UTC 2010 - [email protected]
+
+- readding whitespace lost in autobuild
+
+-------------------------------------------------------------------
+Thu Dec 10 11:09:31 CET 2009 - [email protected]
+
+- regenerated diffs to remove fuzzy hunks
+
+-------------------------------------------------------------------
+Wed Dec  9 14:04:55 CET 2009 - [email protected]
+
+- updated to version 1.0.0:
+    * update of the decompounding component for German (jWordSplitter 3.0)
+    * update to segment library, removed loomchild-util library that
+      is no longer needed
+    * update to morfologik-stemming library
+    * add support for Danish, Catalan, Galician, New Zealand and South African
+      English
+    * add Slovak tagger and synthesizer dictionaries
+    * add Russian synthesizer dictionary and disambiguator
+    * add SRX-based sentence tokenizers for Slovenian, Icelandic, and Russian
+    * enable general rules in the Slovenian module
+    * more features for the server-side LanguageTool
+    * simple replacement rule can be used now with any language
+    * change from DTD to XML schema for rule files
+    * bug with counting column positions (sf#2878819)
+    * bug in unification.
+    * bug with matching elements that have POS tag information and whitespace
+      attributes
+    * many new or fixed rules; many fixes in the dictionaries
+* added subpackages: sk(Slovak), gl(Galician)
+
+-------------------------------------------------------------------
+Mon Nov  9 16:47:57 CET 2009 - [email protected]
+
+- used basis-link instead of basis3.1 to fix build with OOo-3.2-beta1
+
+-------------------------------------------------------------------
+Tue Nov  3 19:09:35 UTC 2009 - [email protected]
+
+- updated patches to apply with fuzz=0
+
+-------------------------------------------------------------------
+Thu Aug 20 16:22:14 CEST 2009 - [email protected]
+
+- added back the prebuilt commons-logging.jar; did not use the system one
+  because it was not available on SLED11 and it was not worth doing extra
+  hacks for 60kB big file (bnc#530007)
+- fixed to print reasonable error messages with JRE 1.5; we removed
+  the prebuilt JRE 1.5 compat stuff because we would need to add the
+  corresponding sources into the source package and it was hard to locate
+- added jre >= 1.6 to Requires
+
+-------------------------------------------------------------------
+Thu Aug  6 13:51:51 CEST 2009 - [email protected]
+
+- updated to version 0.9.9:
+    * bugs with pairing brackets
+    * paragraph-level rules crasher (sf#2787814)
+    * new sentence tokenizer that uses SRX format
+    * support sentences written in different languages
+    * truncated suggested replacements for false friends
+    * disallowed using rules that were turned off by default
+    * recognize mistyped lowercase words that should be uppercase
+    * update of morfologik-stemming library to version 1.1.4 (sf#2613574)
+    * more grammar rules and updated translations
+- removed the unsupported Czech dictionary; was packaged by mistake
+- fixed dependency of dictionaries; they should require exact version
+  of the framework
+
+-------------------------------------------------------------------
+Fri Jul  3 17:45:32 CEST 2009 - [email protected]
+
+- added detection of installed dictionaries to do not show many errors
+  when they are not installed (bnc#523973)
+
+-------------------------------------------------------------------
+Thu May 21 16:29:38 CEST 2009 - [email protected]
+
+* fixed encoding of the menu entries (bnc#501037)
+
+-------------------------------------------------------------------
+Fri Apr 10 15:19:21 CEST 2009 - [email protected]
+
+- improved the scriptlets to force new versions and remove cache of the older
+  versions
+- added missing Jaminid and jdic sources and README-libs.txt to fulfil LGPL
+  (bnc#487807)
+
+-------------------------------------------------------------------
+Wed Mar 18 17:10:31 CET 2009 - [email protected]
+
+- updated to version 0.9.7:
+    * add Czech dictionary
+    * preliminary support for Romanian
+    * new tagger dictionary for Russian
+    * add compound rules for English and Polish
+    * support for new Proofreading API in OOo-3.0.1
+    * new features to the rule disambiguator, such as
+      unification, filtering, deleting and adding interpretations
+    * no errors visible in context menu for some languages
+    * ClassCastException crash with non-English texts
+    * remove redundant toolbar button (bnc#471540)
+    * new menu command "Recheck document"
+    * possibility to add shorter comments for rules to be 
+      displayed in OpenOffice.org 3.x context menus
+    * many other bugs in the tool and dictionaries
+- added jre >= 1.5 to Requires (bnc#471540)
+- bumped dependency on OpenOffice_org to version >= 3.0.99
+
+-------------------------------------------------------------------
+Mon Sep 22 18:06:52 CEST 2008 - [email protected]
+
+- package created, version 0.9.3 (fate#304616, fate#304618, fate#304619,
+  fate#304620, fate#304621)
+

calling whatdependson for 11.3-i586


New:
----
  JLanguageTool-0.9.3-system-ooo-jars.diff
  JLanguageTool-0.9.9-ignore-jre-1.5.diff
  JLanguageTool-1.2-find-junit-jar.diff
  JLanguageTool-1.2-package-dicts-separately.diff
  JLanguageTool-1.2.tar.bz2
  Jaminid-0.99.tar.bz2
  jdic-20061102-src.tar.bz2
  libreoffice-languagetool.changes
  libreoffice-languagetool.spec
  lo-LanguageTool-data
  lo-LanguageTool-gen-spec

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libreoffice-languagetool.spec ++++++
++++ 623 lines (skipped)

++++++ JLanguageTool-0.9.3-system-ooo-jars.diff ++++++
--- build.properties
+++ build.properties
@@ -59,10 +59,10 @@
 ext.log4j.lib = ${ext.dir}/build/cobertura/log4j-1.2.9.jar
 ext.jakarta-oro.lib = ${ext.dir}/build/cobertura/jakarta-oro-2.0.8.jar
 
-ext.ooo.juh.lib = ${ext.ooo.dir}/juh.jar
-ext.ooo.unoil.lib = ${ext.ooo.dir}/unoil.jar
-ext.ooo.ridl.lib = ${ext.ooo.dir}/ridl.jar
-ext.ooo.jurt.lib = ${ext.ooo.dir}/jurt.jar
+ext.ooo.juh.lib = ${sys.ooo.dir}/ure/share/java/juh.jar
+ext.ooo.unoil.lib = ${sys.ooo.dir}/basis-link/program/classes/unoil.jar
+ext.ooo.ridl.lib = ${sys.ooo.dir}/ure/share/java/ridl.jar
+ext.ooo.jurt.lib = ${sys.ooo.dir}/ure/share/java/jurt.jar
 
 build.meta-inf = ${build.dir}/META-INF
 final.name = LanguageTool
++++++ JLanguageTool-0.9.9-ignore-jre-1.5.diff ++++++
Index: build.xml
================================================================================
--- build.xml
+++ build.xml
@@ -414,11 +414,6 @@
 <copy file="${ext.commons.lang.lib}" todir="${dist.dir}" />
 <copy file="${ext.bliki.lib}" todir="${dist.dir}" />
 <copy file="${ext.junit.lib}" todir="${dist.dir}" />
-<!-- JAXB jars for Java 1.5 -->        
-<copy file="${ext.jaxb-api.lib}" todir="${dist.dir}" />
-<copy file="${ext.jaxb-impl.lib}" todir="${dist.dir}" />
-<copy file="${ext.jsr.lib}" todir="${dist.dir}" />
-<copy file="${ext.activation.lib}" todir="${dist.dir}" />
 
 
 <copy todir="${dist.dir}/linux">
--- src/java/de/danielnaber/languagetool/gui/Configuration.java
+++ src/java/de/danielnaber/languagetool/gui/Configuration.java
@@ -23,6 +23,7 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.lang.ClassLoader;
 import java.util.*;
 
 import de.danielnaber.languagetool.Language;
@@ -145,7 +146,18 @@
       final String motherTongueStr = (String) props
           .get(MOTHER_TONGUE_CONFIG_KEY);
       if (motherTongueStr != null) {
-        motherTongue = Language.getLanguageForShortName(motherTongueStr);
+        // FIXME: hack to disable the functionality for JRE 1.5
+        // javax.xml.bind.JAXBException is part of JRE 1.6
+        boolean isJRE15 = false;
+        try {
+          ClassLoader cl = ClassLoader.getSystemClassLoader();
+          cl.loadClass("javax.xml.bind.JAXBException");
+        } catch (ClassNotFoundException e) {
+          isJRE15 = true;
+        }
+        if (!isJRE15) {
+          motherTongue = Language.getLanguageForShortName(motherTongueStr);
+        }
       }
       final String runServerString = (String) props.get(SERVER_RUN_CONFIG_KEY);
       if (runServerString != null) {
--- src/java/de/danielnaber/languagetool/openoffice/Main.java
+++ src/java/de/danielnaber/languagetool/openoffice/Main.java
@@ -25,6 +25,7 @@
  */
 import java.io.IOException;
 import java.io.File;
+import java.lang.ClassLoader;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
@@ -451,6 +452,14 @@
    * @return An array of Locales supported by LT.
    */
   public final Locale[] getLocales() {
+    // FIXME: hack to disable the functionality for JRE 1.5
+    // javax.xml.bind.JAXBException is part of JRE 1.6
+    try {
+       ClassLoader cl = ClassLoader.getSystemClassLoader(); 
+       cl.loadClass("javax.xml.bind.JAXBException");
+    } catch (ClassNotFoundException e) {
+       return new Locale[0];
+    }
     try {
       int dims = 0;
       for (final Language element : Language.LANGUAGES) {
@@ -614,9 +623,9 @@
     if (version != null
         && (version.startsWith("1.0") || version.startsWith("1.1")
             || version.startsWith("1.2") || version.startsWith("1.3") || 
version
-            .startsWith("1.4"))) {
+            .startsWith("1.4") || version.startsWith("1.5"))) {
       final DialogThread dt = new DialogThread(
-          "Error: LanguageTool requires Java 1.5 or later. Current version: "
+          "Error: LanguageTool requires Java 1.6 or later. Current version: "
               + version);
       dt.start();
       return false;
++++++ JLanguageTool-1.2-find-junit-jar.diff ++++++
--- build.xml
+++ build.xml
@@ -22,6 +22,8 @@
         <pathelement location="${ext.bliki.lib}" />
                <pathelement location="${ext.segment.lib}" />
                <!-- -->
+               <pathelement location="${ext.junit.lib}"/>
+               <!-- -->
                <pathelement location="${ext.ooo.juh.lib}" />
                <pathelement location="${ext.ooo.unoil.lib}" />
                <pathelement location="${ext.ooo.ridl.lib}" />
++++++ JLanguageTool-1.2-package-dicts-separately.diff ++++++
--- build.xml
+++ build.xml
@@ -443,105 +443,56 @@
 <copy file="${resource.dir}/segment.srx" todir="${dist.dir}/resource" />
 
 <copy file="${resource.dir}/en/tagset.txt" todir="${dist.dir}/resource/en" />
-<copy file="${resource.dir}/en/english.dict" todir="${dist.dir}/resource/en" />
-<copy file="${resource.dir}/en/english.info" todir="${dist.dir}/resource/en" />
-<copy file="${resource.dir}/en/english_synth.dict" 
todir="${dist.dir}/resource/en" />
-<copy file="${resource.dir}/en/english_synth.info" 
todir="${dist.dir}/resource/en" />
 <copy file="${resource.dir}/en/english_tags.txt" 
todir="${dist.dir}/resource/en" />
 <copy file="${resource.dir}/en/disambiguation.xml" 
todir="${dist.dir}/resource/en" />
 <copy file="${resource.dir}/en/compounds.txt" todir="${dist.dir}/resource/en" 
/>
 
 <copy file="${resource.dir}/eo/etikedoj.txt" todir="${dist.dir}/resource/eo" />
 
-<copy file="${resource.dir}/it/italian.dict" todir="${dist.dir}/resource/it" />
-<copy file="${resource.dir}/it/italian.info" todir="${dist.dir}/resource/it" />
 <copy file="${resource.dir}/it/readme-morph-it.txt" 
todir="${dist.dir}/resource/it" />
 
-<copy file="${resource.dir}/fr/french.dict" todir="${dist.dir}/resource/fr" />
-<copy file="${resource.dir}/fr/french.info" todir="${dist.dir}/resource/fr" />
 <copy file="${resource.dir}/fr/README_lexique.txt" 
todir="${dist.dir}/resource/fr" />
 <copy file="${resource.dir}/fr/tagset.LT.txt" todir="${dist.dir}/resource/fr" 
/>
 <copy file="${resource.dir}/fr/disambiguation.xml" 
todir="${dist.dir}/resource/fr" />
 
-<copy file="${resource.dir}/gl/galician.dict" todir="${dist.dir}/resource/gl" 
/>
-<copy file="${resource.dir}/gl/galician.info" todir="${dist.dir}/resource/gl" 
/>
 <copy file="${resource.dir}/gl/README" todir="${dist.dir}/resource/gl" />
 
-<copy file="${resource.dir}/es/spanish.dict" todir="${dist.dir}/resource/es" />
-<copy file="${resource.dir}/es/spanish.info" todir="${dist.dir}/resource/es" />
 <copy file="${resource.dir}/es/etiquetas-eagles.txt" 
todir="${dist.dir}/resource/es" />
-<copy file="${resource.dir}/es/spanish_synth.dict" 
todir="${dist.dir}/resource/es" />  
-<copy file="${resource.dir}/es/spanish_synth.info" 
todir="${dist.dir}/resource/es" />  
 <copy file="${resource.dir}/es/spanish_tags.txt" 
todir="${dist.dir}/resource/es" />    
 <copy file="${resource.dir}/es/README" todir="${dist.dir}/resource/es" />
 
 <copy file="${resource.dir}/da/danish_tags.txt" 
todir="${dist.dir}/resource/da" />
-<copy file="${resource.dir}/da/danish.dict" todir="${dist.dir}/resource/da" />
-<copy file="${resource.dir}/da/danish.info" todir="${dist.dir}/resource/da" />
 
-<copy file="${resource.dir}/de/german.dict" todir="${dist.dir}/resource/de" />
-<copy file="${resource.dir}/de/german.info" todir="${dist.dir}/resource/de" />
 <copy file="${resource.dir}/de/compounds.txt" todir="${dist.dir}/resource/de" 
/>
 <copy file="${resource.dir}/de/added.txt" todir="${dist.dir}/resource/de" />
 <copy file="${resource.dir}/de/tagset.txt" todir="${dist.dir}/resource/de" />
 
-<copy file="${resource.dir}/pl/polish.dict" todir="${dist.dir}/resource/pl" />
-<copy file="${resource.dir}/pl/polish.info" todir="${dist.dir}/resource/pl" />
-<copy file="${resource.dir}/pl/polish_synth.dict" 
todir="${dist.dir}/resource/pl" />
-<copy file="${resource.dir}/pl/polish_synth.info" 
todir="${dist.dir}/resource/pl" />
 <copy file="${resource.dir}/pl/polish_tags.txt" 
todir="${dist.dir}/resource/pl" />
 <copy file="${resource.dir}/pl/compounds.txt" todir="${dist.dir}/resource/pl" 
/>
 <copy file="${resource.dir}/pl/multiwords.txt" todir="${dist.dir}/resource/pl" 
/>
 <copy file="${resource.dir}/pl/disambiguation.xml" 
todir="${dist.dir}/resource/pl" />
 
-<copy file="${resource.dir}/nl/dutch.dict" todir="${dist.dir}/resource/nl" />
-<copy file="${resource.dir}/nl/dutch.info" todir="${dist.dir}/resource/nl" />
-<copy file="${resource.dir}/nl/dutch_synth.dict" 
todir="${dist.dir}/resource/nl" />
-<copy file="${resource.dir}/nl/dutch_synth.info" 
todir="${dist.dir}/resource/nl" />
 <copy file="${resource.dir}/nl/dutch_tags.txt" todir="${dist.dir}/resource/nl" 
/>
 <copy file="${resource.dir}/nl/disambiguation.xml" 
todir="${dist.dir}/resource/nl" />
 
-<copy file="${resource.dir}/sv/swedish.info" todir="${dist.dir}/resource/sv" />
-<copy file="${resource.dir}/sv/swedish.dict" todir="${dist.dir}/resource/sv" />
 <copy file="${resource.dir}/sv/compounds.txt" todir="${dist.dir}/resource/sv" 
/>
 
-<copy file="${resource.dir}/uk/ukrainian.dict" todir="${dist.dir}/resource/uk" 
/>
-
-<copy file="${resource.dir}/ru/russian.dict" todir="${dist.dir}/resource/ru" />
-<copy file="${resource.dir}/ru/russian.info" todir="${dist.dir}/resource/ru" />
 <copy file="${resource.dir}/ru/russian_tags.txt" 
todir="${dist.dir}/resource/ru" />
-<copy file="${resource.dir}/ru/russian_synth.dict" 
todir="${dist.dir}/resource/ru" />
-<copy file="${resource.dir}/ru/russian_synth.info" 
todir="${dist.dir}/resource/ru" />
 <copy file="${resource.dir}/ru/tags_russian.txt" 
todir="${dist.dir}/resource/ru" />
 <copy file="${resource.dir}/ru/compounds_ru.txt" 
todir="${dist.dir}/resource/ru" />
 <copy file="${resource.dir}/ru/disambiguation.xml" 
todir="${dist.dir}/resource/ru" />
 
-<copy file="${resource.dir}/ro/romanian.dict" todir="${dist.dir}/resource/ro" 
/>
-<copy file="${resource.dir}/ro/romanian.info" todir="${dist.dir}/resource/ro" 
/>
-<copy file="${resource.dir}/ro/romanian_synth.dict" 
todir="${dist.dir}/resource/ro" />
-<copy file="${resource.dir}/ro/romanian_synth.info" 
todir="${dist.dir}/resource/ro" />
 <copy file="${resource.dir}/ro/romanian_tags.txt" 
todir="${dist.dir}/resource/ro" />
 <copy file="${resource.dir}/ro/disambiguation.xml" 
todir="${dist.dir}/resource/ro" />
 
-<copy file="${resource.dir}/sk/slovak.dict" todir="${dist.dir}/resource/sk" />
-<copy file="${resource.dir}/sk/slovak.info" todir="${dist.dir}/resource/sk" />
 <copy file="${resource.dir}/sk/compounds.txt" todir="${dist.dir}/resource/sk" 
/>
 <copy file="${resource.dir}/sk/README" todir="${dist.dir}/resource/sk" />
-<copy file="${resource.dir}/sk/slovak_synth.dict" 
todir="${dist.dir}/resource/sk" />
-<copy file="${resource.dir}/sk/slovak_synth.info" 
todir="${dist.dir}/resource/sk" />
 <copy file="${resource.dir}/sk/slovak_tags.txt" 
todir="${dist.dir}/resource/sk" />
 
-<copy file="${resource.dir}/ml/malayalam.dict" todir="${dist.dir}/resource/ml" 
/>
-<copy file="${resource.dir}/ml/malayalam.info" todir="${dist.dir}/resource/ml" 
/>
-
 <copy file="${resource.dir}/ca/catalan_synth.dict" 
todir="${dist.dir}/resource/ca" />
 <copy file="${resource.dir}/ca/catalan_tags.txt" 
todir="${dist.dir}/resource/ca" />
-<copy file="${resource.dir}/ca/catalan.dict" todir="${dist.dir}/resource/ca" />
-<copy file="${resource.dir}/ca/catalan.info" todir="${dist.dir}/resource/ca" />
 <copy file="${resource.dir}/ca/README" todir="${dist.dir}/resource/ca" />
 
-<copy file="${resource.dir}/xx/dummy.dict" 
tofile="${dist.dir}/resource/cs/czech.dict" />
-
 <!-- prepare properties file automatically -->
 <javac encoding="${encoding}" srcdir="${src.dir}/dev" 
includes="de/danielnaber/languagetool/dev/PrintLocales.java" 
destdir="${build.classes}" target="${target}" debug="${debug}">
 </javac>
--- src/java/de/danielnaber/languagetool/openoffice/Main.java
+++ src/java/de/danielnaber/languagetool/openoffice/Main.java
@@ -23,6 +23,7 @@
  * 
  * @author Marcin MiƂkowski
  */
+import java.io.IOException;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -476,9 +477,18 @@
    *          The Locale to check.
    */
   public final boolean hasLocale(final Locale locale) {
+    List<String> dummyList = new ArrayList<String>();
     try {
       for (final Language element : Language.LANGUAGES) {
-        if (element.getShortName().equals(locale.Language)) {
+        // FIXME: dirty hack that checks whether the dictionary is really 
installed
+        //        it is better to have dictionaries in optional packages
+        boolean dictionaryExists = true;
+        try {
+         element.getTagger().tag(dummyList);
+        } catch (IOException e) {
+          dictionaryExists = false;
+        }
+        if (dictionaryExists && 
element.getShortName().equals(locale.Language)) {
           return true;
         }
       }
--- src/java/de/danielnaber/languagetool/tagging/BaseTagger.java
+++ src/java/de/danielnaber/languagetool/tagging/BaseTagger.java
@@ -61,6 +61,9 @@
     // caching IStemmer instance - lazy init
     if (morfologik == null) {      
       final URL url = this.getClass().getResource(getFileName());
+      if (url == null) {
+        throw new IOException("Did not detect the dictonary file");
+      }
       morfologik = new DictionaryLookup(Dictionary.read(url));
     }
 
--- src/java/de/danielnaber/languagetool/tagging/cs/CzechTagger.java
+++ src/java/de/danielnaber/languagetool/tagging/cs/CzechTagger.java
@@ -60,6 +60,9 @@
     // caching Lametyzator instance - lazy init
     if (morfologik == null) {      
       final URL url = 
JLanguageTool.getDataBroker().getFromResourceDirAsUrl(RESOURCE_FILENAME);
+      if (url == null) {
+        throw new IOException("Did not detect the dictonary file");
+      }
       morfologik = new DictionaryLookup(Dictionary.read(url));
     }
 
--- src/java/de/danielnaber/languagetool/tagging/de/GermanTagger.java
+++ src/java/de/danielnaber/languagetool/tagging/de/GermanTagger.java
@@ -74,6 +74,9 @@
     // caching Lametyzator instance - lazy init
     if (morfologik == null) {      
       final URL url = 
JLanguageTool.getDataBroker().getFromResourceDirAsUrl(DICT_FILENAME);
+      if (url == null) {
+        throw new IOException("Did not detect the dictonary file");
+      }
       morfologik = new DictionaryLookup(Dictionary.read(url));      
     }
     if (manualTagger == null) {
--- src/java/de/danielnaber/languagetool/tagging/pl/PolishTagger.java
+++ src/java/de/danielnaber/languagetool/tagging/pl/PolishTagger.java
@@ -61,6 +61,9 @@
     // caching Lametyzator instance - lazy init
     if (morfologik == null) {      
       final URL url = 
JLanguageTool.getDataBroker().getFromResourceDirAsUrl(RESOURCE_FILENAME);
+      if (url == null) {
+        throw new IOException("Did not detect the dictonary file");
+      }
       morfologik = new DictionaryLookup(Dictionary.read(url));
     }
 
--- src/java/de/danielnaber/languagetool/tagging/ro/RomanianTagger.java
+++ src/java/de/danielnaber/languagetool/tagging/ro/RomanianTagger.java
@@ -71,6 +71,9 @@
     // caching Lametyzator instance - lazy init
     if (morfologik == null) {      
       final URL url = 
JLanguageTool.getDataBroker().getFromResourceDirAsUrl(RESOURCE_FILENAME);
+      if (url == null) {
+        throw new IOException("Did not detect the dictonary file");
+      }
       morfologik = new DictionaryLookup(Dictionary.read(url));
     }
 
--- src/java/de/danielnaber/languagetool/tagging/uk/UkrainianMyspellTagger.java
+++ src/java/de/danielnaber/languagetool/tagging/uk/UkrainianMyspellTagger.java
@@ -62,6 +62,9 @@
     if (wordsToPos == null) {
       wordsToPos = new HashMap<String, String[]>();
       final InputStream resourceFile = 
JLanguageTool.getDataBroker().getFromResourceDirAsStream(RESOURCE_FILENAME);
+      if (resourceFile == null) {
+        throw new IOException("Did not detect the dictonary file");
+      }
       // System.err.println("reading dict: " + resourceFile);
 
       final BufferedReader input = new BufferedReader(new InputStreamReader(
++++++ lo-LanguageTool-data ++++++
%lang ca Catalan 0
%license GPL
%files %doc src/resource/ca/README

%lang de German 0
%license CCA-SA3.0
%files %doc src/resource/de/{errors.txt,tagset.txt}

%lang en English 0
%license BSD3c, BSD4c, Public Domain, Freeware
%files %doc 
src/resource/en/{12dicts-readme.html,agid-readme.txt,errors.txt,pos-readme.txt}

%lang gl Galician 0
%license GPL
%files %doc src/resource/gl/{LICENSE,README,README.cvs}

%lang fr French 0
%license GPLv2.0, LGPLv2.1, MPLv1.1
%files %doc src/resource/fr/README_lexique.txt

%lang it Italian 0
%license CCA-SA2.0, LGPL
%files %doc src/resource/it/readme-morph-it.txt

%lang nl Dutch 0
%license LGPL

%lang pl Polish 0
%license LGPL

%lang ro Romanian 0
%license LGPL

%lang ru Russian 0
%license LGPL

%lang sv Swedish 0
%license LGPL

%lang sk Slovak 0
%license LGPL
%files %doc src/resource/sk/README

%lang es Spanish 0
%license GPL
%files %doc src/resource/es/{README,README.cvs}

%lang sv Swedish 0
%license LGPL
++++++ lo-LanguageTool-gen-spec ++++++
#!/usr/bin/perl -w

# This script changes the definite article of ProductName

use strict;

sub init_lang_data($$$$)
{
    my ($datap, $curLang, $long_name, $level) = @_;
    
    $datap->{$curLang}{'long_name'} = $long_name;
    $datap->{$curLang}{'level'} = $level;
    $datap->{$curLang}{'locale'} = "$curLang";
    $datap->{$curLang}{'locale'} =~ s/-/_/g;
    $datap->{$curLang}{'package'} = ();
    
    return $curLang;
}    

sub read_data($$)
{
    my ($data_file, $datap) = @_;
    my $curLang;
    
    open DATA , "< $data_file" or die "Can't open '$data_file'\n";

    while( my $line = <DATA>){
        chomp $line;
        if ( $line =~ m/^\s*\%lang\s+([\w-]+)\s+(\w+)\s+(\d+)\s*$/ ) {
            $curLang = init_lang_data($datap, "$1", "$2", "$3");
        } elsif ( $line =~ m/^\s*\%lang\s+([\w-]+)\s+\"([\w\s]+)\"\s+(\d+)\s*$/ 
) {
            $curLang = init_lang_data($datap, "$1", "$2", "$3");
        } elsif ( $line =~ /^\s*\%package\s+(.*)$/ ) {
            push @ {$datap->{$curLang}{'package'}}, "$1";
        } elsif ( $line =~ /^\s*\%license\s+(.*)$/ ) {
            $datap->{$curLang}{'license'} = "$1";
        } elsif ( $line =~ /^\s*\%files\s+(.*)$/ ) {
            push @ {$datap->{$curLang}{'files'}}, "$1";
        } elsif ( $line =~ /^\s*$/ ) {
            # ignore empty line
        } else {
            die "Synrax error in $data_file, line $.\n";
        }
    }
    close(DATA);
}

sub write_generated_section_start()
{
    print "########################################################\n";
    print "# Start of a section generated by lo-langtool-gen-spec\n";
    print "# Do not edit!\n";
    print "########################################################\n";
    print "\n";
}

sub write_generated_section_end()
{
    print "######################################################\n";
    print "# End of a section generated by lo-langtool-gen-spec\n";
    print "######################################################\n";
    print "\n";
}

sub write_section_comment($)
{
    my ($section_name) = @_;

    print "#\n";
    print "# $section_name\n";
    print "#\n";
    print "\n";

}

sub write_level_begin($$)
{
    my ($curLevel, $newLevel) = @_;

    if ($curLevel != $newLevel) {
        print "%endif\n"                                if ($curLevel > 0);
        print "%if %test_build_langs >= $newLevel\n"    if ($newLevel > 0);
        print "\n";
    }

    return $newLevel;
}

sub write_level_end($)
{
    my ($curLevel) = @_;

    if ($curLevel > 0) {
        print "%endif\n";
        print "\n";
    }

    return 0;
}

sub write_langtool_package_section($$)
{
    my ($datap, $curLang) = @_;

    return if ("$curLang" eq "en-US"); # we do not have the l10n-en-US package
    
    unless (defined $datap->{$curLang}{'license'}) {
        die "Error: License is not defined for the language: $curLang";
    }

    print "%package -n libreoffice-languagetool-$curLang\n";
    print "License:        $datap->{$curLang}{'license'}\n";
    print "Summary:        $datap->{$curLang}{'long_name'} Dictionary for 
LibreOffice Language Tool\n";
    print "Group:          Productivity/Office/Dictionary\n";
    print "Provides:       
locale(libreoffice-languagetool:$datap->{$curLang}{'locale'})\n";
    print "PreReq:         libreoffice-ure >= 2.99\n";
    print "Requires:       libreoffice-languagetool = %version\n";
    print "# compat stuff\n";
    print "Provides:       OpenOffice_org-LanguageTool-$curLang = %version\n";
    print "Obsoletes:      OpenOffice_org-LanguageTool-$curLang <= %version\n";

    foreach  my $line (@{$datap->{$curLang}{'package'}}) {
        print "$line\n";
    }

    print "\n";

    print "%description -n libreoffice-languagetool-$curLang\n";
    print "The $datap->{$curLang}{'long_name'} dictionary that can be used to 
check grammar and other more\n";
    print "complex mistakes using the LibreOffice language tool extension.\n";
    print "\n";
    print "\n";
    print "\n";
}

sub write_langtool_scripts_section($$)
{
    my ($datap, $curLang) = @_;

    print "# $curLang\n";
    print "%posttrans -n libreoffice-languagetool-$curLang\n";
    print "%_datadir/%ooo_home/link-to-ooo-home 
%_datadir/%ooo_home/files-langtool-$datap->{$curLang}{'locale'}.txt || true\n";
    print "\n";
    print "%preun -n libreoffice-languagetool-$curLang\n";
    print "test \"\$1\" = \"0\" && cp 
%_datadir/%ooo_home/files-langtool-$datap->{$curLang}{'locale'}.txt 
%_datadir/%ooo_home/files-langtool-$datap->{$curLang}{'locale'}.txt.postun || 
true\n";
    print "\n";
    print "%postun -n libreoffice-languagetool-$curLang\n";
    print "test \"\$1\" = \"0\" && %_datadir/%ooo_home/link-to-ooo-home 
--unlink 
%_datadir/%ooo_home/files-langtool-$datap->{$curLang}{'locale'}.txt.postun || 
true\n";
    print "rm -f 
%_datadir/%ooo_home/files-langtool-$datap->{$curLang}{'locale'}.txt.postun 
2>/dev/null\n"
}

sub write_langtool_files_section($$)
{
    my ($datap, $curLang) = @_;

    print "%files -f files-langtool-$datap->{$curLang}{'locale'}.txt -n 
libreoffice-languagetool-$curLang\n";
    print "%defattr(-,root,root)\n";

    foreach  my $line (@{$datap->{$curLang}{'files'}}) {
        print "$line\n";
    }

    print "\n";
}

sub write_langtool_section($$$)
{
    my ($datap, $write_single_lang_section, $section_name) = @_;
    my $curLevel = 0;

    write_section_comment($section_name);
    
    foreach my $curLang (sort keys %{$datap}) {
        $curLevel = write_level_begin($curLevel, $datap->{$curLang}{'level'});
        & {$write_single_lang_section} ($datap, $curLang);
    }

    $curLevel = write_level_end($curLevel);
}

sub usage()
{
    print "This tool generates pieces of the LanguageTool spec\n\n" .

          "Usage:\n".
          "\tlo-langtool-gen-spec [--help] data_file...\n\n" .
        
          "Options:\n" .
          "\t--help: prints this help\n" .
          "\tdata_file: input file\n";
}


# info about localizations
# it is a hash, the key is the lang id, e.g. "en-US", the value is:
#         a hash, keys introduce perl-like structure items:
#             'long_name'               ... string, long name of the language, 
e.g. "American"
#             'level'                   ... integer, level in whih it should 
get build, e.g. '1'
#                                           it is the level in the rpm spec to 
do a reduced build
#             'locale'                  ... string, it is actually the lang id 
with undersore instead of dash,
#                                           e.g. "en_US"
#             'package'                 ... array of strings that should be 
added to the %package section for
#                                           the given language
#             'license'                 ... string, defines the license of the 
package
#             'files'                   ... array of strings that should be 
added to the %files section for
#                                           the given language
my %data;
my $l10n = 1;
my $help = 1;


for my $arg (@ARGV) {
    if ($arg eq '--help' || $arg eq '-h') {
        usage;
        exit 0;
    } else {
        if (-f $arg) {
            read_data($arg, \%data);
        } else {
            die "File does not exist: $arg\n";
        }
    }
}

write_generated_section_start();
write_langtool_section(\%data, \&write_langtool_package_section, "langtool 
dictionaries");
write_generated_section_end();

write_generated_section_start();
write_langtool_section(\%data, \&write_langtool_scripts_section, "langtool 
dictionaries");
write_langtool_section(\%data, \&write_langtool_files_section, "langtool 
dictionaries");
write_generated_section_end();

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to