Back to LanguageTool Homepage - Privacy - Imprint

LanguageTool 4.9 No appropriate language found error

I am using the maven dependency for LanguageTool in my pom.xml with the artifactId of language-all.

I have upgraded from LanguageTool 4.8 from 4.9.

I am now getting the following error in my app:
No appropriate language found, not even en-US. Supported languages: [Arabic, Arabic (Algeria)]

Before, in v4.8, LanguageTool handled all the other languages.

Not sure it is related, but I noticed that the language-module.properties file has only got the following:
languageClasses=org.languagetool.language.Arabic,org.languagetool.language.AlgerianArabic

Having said that in v4.8 it only seemed to contain the English languages but it still worked for all of the other languages:
languageClasses=org.languagetool.language.English,org.languagetool.language.AmericanEnglish,org.languagetool.language.BritishEnglish,org.languagetool.language.AustralianEnglish,org.languagetool.language.CanadianEnglish,org.languagetool.language.NewZealandEnglish,org.languagetool.language.SouthAfricanEnglish

What has changed in v4.9 to cause this?

Thanks.

Danny

Hi, I don’t know of any change related to this in 4.9. There should be several language-module.properties files, each containing the class references for its language. Where exactly did you find the language-module.properties file that only contains Arabic?

Hi Daniel,

I uncompressed our application .jar file and the language-module.properties file that contains Arabic was in the META-INF/org/languagetool.

Thanks

That sounds like your process that builds the JARs only keeps one of the several language-module.properties files from LanguageTool.

Hi Daniel,

Our build process is identical to when we used v4.8 which did work so not sure why there is a change in 4.9.

I grepped for language-module.properties in both the working version 4.8 and version 4.9 and it only appears in META-INF/org/languagetool/

Any other suggestions?

Thanks for your help

The code in LT is this: Enumeration<URL> propertyFiles = Language.class.getClassLoader().getResources(PROPERTIES_PATH);. So we look for all files named language-module.properties and consider them. If there’s only one, and that one has only Arabic, LT won’t work for English. I’m not sure why it used to work before. Are you sure there’s no exception thrown anywhere that you might miss?

Given Arabic's alphabetic position, it’s possible that somewhere along the line an array variable has been miscast into a singular variable. (instead of getting the array of module.properties files, you get only the first entry of the array … only question is, where does it happen?)

Thanks for your replies.

We use the maven shade plugin which packages our app in an “uber jar”.
I think there may be an issue where we are messing up the module.properties file when we are packaging our app.

I will investigate and update this thread when I have discovered more info.

Thanks for all your pointers.

I have discovered what the issue is now. Thanks for everyones help.

If you use the maven shade plugin, you need to add the following to your pom under the maven-shade-plugin section:

<configuration>
  <transformers>
    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
      <resource>META-INF/org/languagetool/language-module.properties</resource>
    </transformer>
</configuration>

This will ensure that all language-module.properties are appended correctly.

1 Like