make openoffice_en backend works for other language
I tried to use the openoffice_en backend in french by using the files provided by libreoffice. It works but I need to keep the 'en' in tq_language list:
with this configuration, only online thesaurus are used
let g:tq_language=['fr']
let g:tq_openoffice_en_file="/usr/share/mythes/th_fr_FR_v2"
let g:tq_enabled_backends=["openoffice_en", "cnrtl_fr", "synonymo_fr"]
a workaround is to add 'en' the the language list and only french backend both libreoffice and online thesaurus are workings
let g:tq_language=['en', 'fr']
let g:tq_openoffice_en_file="/usr/share/mythes/th_fr_FR_v2"
let g:tq_enabled_backends=["openoffice_en", "cnrtl_fr", "synonymo_fr"]
but it become complicate if I want to have english and french backend activated and switch language by modifying tq_language option. where I have to change, the language, the openoffice_file and the backend options. I tried
let b:myLang==0
function! ToggleThesaurus()
if b:myLang==0
let g:tq_language=['en', 'fr']
let g:tq_openoffice_en_file="/usr/share/mythes/th_fr_FR_v2"
let g:tq_enabled_backends=["openoffice_en", "cnrtl_fr", "synonymo_fr"]
b:gyLang=1
else
let g:tq_language=['en']
let g:tq_openoffice_en_file="/usr/share/mythes/th_en_US_v2"
let g:tq_enabled_backends=["openoffice_en", "mthesaur_txt", "datamuse_com"]
b:gyLang=0
endif
endfunction
but if the switch works for the libreoffice thesaurus, the plugin only use the first backend list. In this example, I am able to use the three french thesaurus backend but switching to english use only openoffice_en one. If I enable all backend before the function, in french, I'll get answer from all backend in french and in english.
hmm, tq_language is a toggle to see which backend to toggle on. By then, I didn't know my openoffice backend even work with French dictionary, so openoffice was configured as en backend.
https://github.com/Ron89/thesaurus_query.vim/blob/23d8aa3f7d1a785e31e760e1b6b3b4c18abf8332/autoload/thesaurus_query/backends/openoffice_en_lookup.py#L21
Now it seems like this backend can be more flexible and configured to be used as different backends, which caused your problem.
A quick fix would be to change the location I posed above to
language = "fr"
But a more elegant way to resolve it may be to turn office office backend as a series of backends based on dictionaries user points to. But this will incur code change.
Please use the quick fix method first. I will work on the code change method when have the time.