LanguageTool Grammar checker settings to enable it

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ifc494d5e9f17fc4459556ae809ef3ca12a6b7307
This commit is contained in:
Mert Tumer 2022-06-10 14:43:27 +03:00 committed by Gökay ŞATIR
parent 52e703e67a
commit 58ebdb5041
3 changed files with 43 additions and 1 deletions

View file

@ -45,4 +45,21 @@
<item oor:path="/org.openoffice.Office.UI/ColorScheme/ColorSchemes/org.openoffice.Office.UI:ColorScheme['LibreOffice']/DocBoundaries"><prop oor:name="IsVisible" oor:op="fuse"><value>false</value></prop></item>
<item oor:path="/org.openoffice.Office.UI/ColorScheme/ColorSchemes/org.openoffice.Office.UI:ColorScheme['LibreOfficeDev']/DocBoundaries"><prop oor:name="IsVisible" oor:op="fuse"><value>false</value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="en-US" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="en-GB" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="en-CA" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="de-DE" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="es" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="fr" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="it" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="nl" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="nl-BE" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="ar" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="pl-PL" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="ru-RU" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="ja-JP" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="fa" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="zh-CN" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
<item oor:path="/org.openoffice.Office.Linguistic/ServiceManager/GrammarCheckerList"><prop oor:name="ro-RO" oor:op="fuse" oor:type="oor:string-list"><value><it>org.openoffice.lingu.LanguageToolGrammarChecker</it></value></prop></item>
</oor:items>

View file

@ -9,6 +9,18 @@
<allowed_languages desc="List of supported languages of Writing Aids (spell checker, grammar checker, thesaurus, hyphenation) on this instance. Allowing too many has negative effect on startup performance." default="de_DE en_GB en_US es_ES fr_FR it nl pt_BR pt_PT ru">@ALLOWED_LANGUAGES@</allowed_languages>
<!--
This is LanguageTool.org API settings. To turn it on, please set "enabled" property to true.
"base_url" may be https://api.languagetoolplus.com/v2 if the cloud version is used.
However, your data in the document e.g. the text part of it will be sent to the cloud API. Please read the privacy policy: https://languagetool.org/legal/privacy
-->
<languagetool desc="LanguageTool Remote API settings for grammar checking">
<enabled desc="Enable LanguageTool Remote Grammar Checker" type="bool" default="false">false</enabled>
<base_url desc="Http endpoint for the LanguageTool API server, without /check or /languages postfix at the end." type="string" default=""></base_url>
<user_name desc="LangueTool account username for premium usage." type="string" default=""></user_name>
<api_key desc="Api key provided by LanguageTool account for premium usage." type="string" default=""></api_key>
</languagetool>
<sys_template_path desc="Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes." type="path" relative="true" default="systemplate"></sys_template_path>
<child_root_path desc="Path to the directory under which the chroot jails for the child processes will be created. Should be on the same file system as systemplate and lotemplate. Must be an empty directory." type="path" relative="true" default="jails"></child_root_path>
<mount_jail_tree desc="Controls whether the systemplate and lotemplate contents are mounted or not, which is much faster than the default of linking/copying each file." type="bool" default="true"></mount_jail_tree>

View file

@ -1858,7 +1858,11 @@ void COOLWSD::innerInitialize(Application& self)
{ "quarantine_files.path", "quarantine" },
{ "quarantine_files.expiry_min", "30" },
{ "remote_config.remote_url", ""},
{ "storage.wopi.alias_groups[@mode]" , "first"}
{ "storage.wopi.alias_groups[@mode]" , "first"},
{ "languagetool.base_url", ""},
{ "languagetool.api_key", ""},
{ "languagetool.user_name", ""},
{ "languagetool.enabled", "false"},
};
// Set default values, in case they are missing from the config file.
@ -2252,6 +2256,15 @@ void COOLWSD::innerInitialize(Application& self)
AdminEnabled = getConfigValue<bool>(conf, "admin_console.enable", true);
#endif
bool enableLanguageTool = getConfigValue<bool>(conf, "languagetool.enabled", false);
setenv("LANGUAGETOOL_ENABLED", enableLanguageTool ? "true" : "false", 1);
const std::string baseAPIUrl = getConfigValue<std::string>(conf, "languagetool.base_url", "");
setenv("LANGUAGETOOL_BASEURL", baseAPIUrl.c_str(), 1);
const std::string userName = getConfigValue<std::string>(conf, "languagetool.user_name", "");
setenv("LANGUAGETOOL_USERNAME", userName.c_str(), 1);
const std::string apiKey = getConfigValue<std::string>(conf, "languagetool.api_key", "");
setenv("LANGUAGETOOL_APIKEY", apiKey.c_str(), 1);
#if ENABLE_SUPPORT_KEY
const std::string supportKeyString = getConfigValue<std::string>(conf, "support_key", "");