Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make openoffice_en backend works for other language #52

Open
shadowwa opened this issue Jul 3, 2022 · 1 comment
Open

make openoffice_en backend works for other language #52

shadowwa opened this issue Jul 3, 2022 · 1 comment

Comments

@shadowwa
Copy link

shadowwa commented Jul 3, 2022

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.

@Ron89
Copy link
Owner

Ron89 commented Jul 4, 2022

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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants