Ask Your Question
0

Import dictionary entries in dic file

asked 2018-10-13 07:57:26 +0100

surferby gravatar image

By this time I know that just saving the entries in the dic file of libre office will not work; it will be replaced by a blank file. People said, that is something related to encoding issue. But is there no other way to batch import entries in libre office dictionary file?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
0

answered 2018-10-16 20:14:08 +0100

Olr gravatar image

updated 2018-10-16 21:25:06 +0100

Strange. What you did is unclear and looks weird.

I tried to modify the file en-US.dic in the folder LibreOffice/share/extensions/dict-en, and I succeeded to add a word that was recognized by LibreOffice when I relaunched it.

But, the better way to add words you need is to go to Menu Tools > Options > Language Settings > Writing aids, then you click on New... in the user-defined dictionaries section. You set the language you need, then you add what you need.

Then, when writing a text, if you type a word that is not recognized by the spellchecker, you can add it to your custom dictionary with a right-click Menu entry > Add to dictionary > Your dictionary.

Edit:

To update a dictionary by script, you can create your own dictionary extension and install it via unopkg.

The syntax is unopkg add -f your_dictionary_extension.oxt

The extension identifier should be the same than the one your language already uses, and unopkg will override the bundled extension.

https://api.libreoffice.org/docs/tool...

To create your own dictionary extension, the best way is to copy/paste the existing extension for your language and edit it.

edit flag offensive delete link more

Comments

The user wants batch import - which is making multiple changes at once, and using the dialog is not the best way.

Still - yes, adding to the file does work, if you use a suitable plain text editor.

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-16 20:21:55 +0100 )edit

Well, I missed that point… I update my answer.

Olr gravatar imageOlr ( 2018-10-16 21:21:04 +0100 )edit
0

answered 2018-10-13 09:10:47 +0100

surferby gravatar image

updated 2018-10-13 09:21:41 +0100

Ok, it sounds like, someone really able to help is here. Sorry for the initial wrong information.

But I really tried to include entries manually and save it, which resulted in a blank file after libre office is opened. What I did-

opened the custom dictionary file with notepad on windows. Placed each word in each row. saved it with utf-8 encoding. That failed.

Later I did the same thing with libre office writer. Saved multiple times with different encoding- saved as text file utf-7, utf-8, utf-16. Renamed the files with .dic extension. Nothing worked. Every time it was placed by a new standard.dic file. When I was creating dic files with writer the option cr and lf was selected. Even though the created dic files with manually put entries did not work.

Then I created a new .dic file. But after opening writer, i could not find that listed under user-defined dictionaries.

I even attempted creating a new dic file from there. Then open that in notepad to put entries. Saved that in utf-8. No luck.

What to do now?

edit flag offensive delete link more
0

answered 2018-10-13 08:42:26 +0100

Mike Kaganski gravatar image

updated 2018-10-13 09:30:56 +0100

By this time I know that just saving the entries in the dic file of libre office will not work; it will be replaced by a blank file. People said, that is something related to encoding issue

The starting premise of the question is false; so I won't try to answer the asked question (i.e., are there other ways) directly, but instead tell how to add entries to the dic file.

The dic file has the following structure:

OOoUserDict1
lang: <none>
type: positive
---
<entries go here><separated by CR or CRLF>

It is a UTF-8-encoded plain-text file without BOM, which may be edited by any plain-text editor that supports that encoding (on Windows, e.g., I use Notepad++). (Batch-)adding entries after the three hyphens works fine for me.

Windows' standard Notepad isn't suitable for the task, because it cannot save UTF-8 without BOM.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-10-13 07:57:26 +0100

Seen: 51 times

Last updated: Oct 16