[libvoikko] API added: voikkoGetGrammarErrorShortDescription
Francis Tyers
ftyers at prompsit.com
Wed Oct 16 18:59:23 EEST 2013
El dl 14 de 10 de 2013 a les 19:19 +0300, en/na Harri Pitkänen va
escriure:
> We now have a new API function for libvoikko:
>
> /**
> * Get the localized short description of the grammar error.
> * @param error The grammar error
> * @param language ISO language code for the lanugage of error description
> * @return The UTF-8 encoded localized error description. Use
> * voikkoFreeErrorMessageCstr to delete the message after use.
> */
> char * voikkoGetGrammarErrorShortDescription(struct VoikkoGrammarError *
> error, const char * language);
>
> This can be used as a replacement for the old function that is now marked as
> deprecated:
>
> const char * voikko_error_message_cstr(int error_code, const char * language);
>
>
> Using the new function you can have the error description depend on the
> specific error, not just the error code. And since we now specify that the
> resulting string must be deleted after use it is possible to load the
> descriptions from a file.
>
> What is still missing is a function voikkoGetGrammarErrorTitle that would
> depend on the error code but not on the specific error. This would be needed
> if we wanted to build a settings pane for enabling or disabling checks for
> specific error types (this exists at least in MS Word). But since we don't
> have the UI yet I left this one out for now.
>
> Libreoffice-voikko has also been modified to use the new API.
>
> The implementation for voikkoGetGrammarErrorShortDescription can be found
> under src/grammar/error.cpp. This is where you can plug in your code for
> producing variable error descriptions, reading them form an XML file or
> something like that.
Excellent! I am going to be away from the end of this week and next week
but I will take a look at it when I get back.
Fran
More information about the Libvoikko
mailing list