How to take a word list of a new language and make it a spell dictionary

I want to make a spell dictionary for a language that is not available in LibO to spell check documents in that language.
I can get an empty .dic file to appear in Libreoffice/4/user/wordbook, but I cannot simply replace the empty file with the same file populated with all the words in it. It always replaces it with an empty one.
Do I need to put the file some other place?
Thanks,
Robert

You have to create an extension. Such an extension is a ZIP archive and includes a dictionary file, an affix file in the Hunspell format (the latter may be empty but must be present anyway), as well as some auxiliary files. I know no guidance about creating such extensions and can only recommend to study existing extensions.

So is there any guidance as to how to build a dictionary extension?

Consult the hunspell documentation - Google is your friend.

I doubt that the Hunspell documentation contains information on packaging LibreOffice extensions.

I doubt it as well. But it does contain information about making the required dictionary files. Fascinating read.

The asker has already made a dictionary, as I understand, but doesn’t know how to enable it in LibreOffice. So, the Hunspell documentation will be a waste of time for him for the moment, while may be very useful for prospective.

1 Like

The question is, how to do it so that LibO does not replace the 9000 word .dic file in /wordbook with an empty .dic file.

That is a wrong question. Yes, you can add a 9000 word list to a custom dictionary provided that you include a relevant header such as:

OOoUserDict1
lang: <none>
type: positive
---

The matter is that the custom dictionary will be useless without a main dictionary because LibreOffice won’t check spelling for a language without a main dictionary.

The header is at the top of the 9000 words.
The thing is I can create a spell dictionary one word at a time, by having the word list in an .odt file and running the spell checker. So why can’t I just replace that dictionary with my fuller dictionary.

You can replace. If there is a problem, there must be something wrong with your file.

Also read this discussion:

The file is in UTF-8 and looks like this:
OOoUserDict1
lang:
type: positive
a
A
á
Á
à
À
ǎ
aa
Aa
áa
Áa
àa
Àa
âa
aamɛɛn
ǎan
aayi
Aayi
Afàʼ
Affo
Áfílíkà
Afómtè
Afùɔ
afùu
Afùu
afÿɛ
agáʼ
agí
Agí

You link refers to somebody wanting to merge four dictionaries of the same language into. What I want to do is have a custom dictionary for this African language.

Sorry, each word is on a separate line

You should replace with the language/locale code. However, you seem to miss the point: if you don’t have a main (or whatever you refer to) dictionary, LibreOffice won’t check spelling in that language. So, read my initial answer again and again, until you understand.

@gabix I want to do the same thing (spell check a language that’s not in LibreOffice). I haven’t succeeded and I can’t see what’s the problem.

I grabbed this extension as this it fits my LO version and its format is close to what I need: https://extensions.libreoffice.org/extensions/swedish-spelling-dictionary-den-stora-svenska-ordlistan

I edited the .oxt file with 7-zip. I deleted the +1 language and all the related code snippets in the auxiliary files. I replaced the .dic and .aff files. I made up a new ISO-like designation for the language and replaced the tags in all the files. I made sure all the file names are renamed appropriately and that the auxiliary files refer to them appropriately. I made sure everything within the files is named and tagged properly. The structure within the .oxt is preserved.

I installed my custom extension in Writer. It shows up nowhere in the application, except for the extension manager.

So why won’t it work? I’d really welcome any help or advice.

Share your extension, I’ll try to see what can be done.

@gabix thank you very much for your help. Here’s the oxt I constructed: share.riseup.net

As I see, you are trying to create a dictionary for a non-existing locale (hu-OA). You can’t. Depending on your goal, you can:

  1. Use hu-HU. In this case, you can only install your extension.
  2. Add your dictionary to an existing extension (you can have multiple dictionaries in one extension).
  3. Use another locale and format your texts accordingly.