Factory method sounds good. The only thing not nice is that static methods
cannot be governed by an interface which would formally conventionalized them
across all languages.

Personally, I like the method where I can pass a language code as a String
and get back the proper language:

  Languages.getLanguageForShortName(langCode)

Wouldn't it be reasonable to discourage directly constructing languages
in favor of using a central factory class like Languages?

Best,

-- Richard

> On 15.12.2015, at 19:31, Daniel Naber <daniel.na...@languagetool.org> wrote:
> 
> Hi,
> 
> users of the API regularly use "new German()" and then wonder why they 
> don't get spell checking. The solution is to use e.g. "new 
> GermanyGerman()" to specify the variant. That's confusing to almost 
> everyone including myself, so I'd like to change the API: the 
> constructor "German" will be deprecated and there will be a static 
> get(Variant) method. From the users' perspective:
> 
> old: new German() - new: German.get(German.Variant.NoSpellChecking)
> old: new GermanyGerman() - new German.get(German.Variant.Germany)
> 
> Same for English and other languages where this is relevant. Let me know 
> if you see a problem with that or if you know a better solution.
> 
> Regards
>  Daniel


------------------------------------------------------------------------------
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to