Faq/General/104

    From The Document Foundation Wiki
    < Faq‎ | General


    How to create a personal dictionary from a list of words?

    To quickly create a dictionary, there must be words in a list, with one word per line. Use the following procedure:

    • Open the list in Writer and select the Tools ▸ Word Count menu to get the number of words in the file.
    • Insert the number at the beginning of the file on a new line.
    • Sort the list:
      • Select all (Ctrl + A).
      • Select the Tools ▸ Sort menu.
      • Leave the default options and press OK.
    • Save the file as text (.txt) and NOT encoded text(.txt) and close the file.
    • Rename the file MyDic.dic or a meaningful name, such as chemical.dic for names of chemical compounds for example.
    • Create another file with the same name as the dictionary, and an extension AFF, containing at least:
    SET UTF-8
    

    This file may also contain rules for word suggestions when the word is unknown.

    Adding dictionaries is done with the help of an extension. You can build a more or less sophisticated extension.

    Create a directory chemistry_dictionary, in which you need to add:

    • The two files mentioned above: chemical.dic and chemical.aff
    • A sub directory META-INF containing a file manifest.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE manifest:manifest PUBLIC "-//OpenOffice.org//DTD Manifest 1.0//EN" "Manifest.dtd">
    <manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
       <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
           manifest:full-path="Dictionaries.xcu"/>
    </manifest:manifest>
    
    • A file dictionnaries.xcu, in which you customize the dictionary name (!must be unique), the names of the files and possibly the local:
    <?xml version="1.0" encoding="UTF-8"?>
    <oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Linguistic" oor:package="org.openoffice.Office">
     <node oor:name="ServiceManager">
        <node oor:name="Dictionaries">
            <node oor:name="HunSpellDic_fr_FR-chimie" oor:op="fuse">
               <prop oor:name="Locations" oor:type="oor:string-list">
                   <value>%origin%/chimie.aff %origin%/chimie.dic</value>
               </prop>
               <prop oor:name="Format" oor:type="xs:string">
                   <value>DICT_SPELL</value>
               </prop>
               <prop oor:name="Locales" oor:type="oor:string-list">
                   <value>fr-FR fr-BE fr-CA fr-CH fr-LU fr-MC</value>
               </prop>
           </node>
       </node>
     </node>  
    </oor:component-data>
    
    • A file description.xml with the following information:
      • Mandatory header:
    <?xml version="1.0" encoding="UTF-8"?>
    <description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006"  xmlns:xlink="http://www.w3.org/1999/xlink">
    
    • An identifier that must be unique (it is advisable to follow the reverse domain name scheme)
       <identifier value="myorganization.myname.chemistry_dictionary" />
    
    • Version of the extension (!not of LibreOffice)
       <driver_version> value="1.0" />
    
    • The name of the extension in LibreOffice
       <display-name>
    

       <name lang="en">Dictionary of chemical molecules</name>

       </display-name>
    
    • OS on which the extension is valid
       <platform value="all"/>
    
    • Versions of LibreOffice for which the extension is valid
     <dependencies>
      <OpenOffice.org-minimal-version Value="3.0" d:name="OpenOffice.org 3.0" />
     </dependencies>
    
    • [Optional] the license that applies (add the corresponding file)
       <registration>
           <simple-license accept-by="admin" suppress-on-update="false" >
               <license-text xlink:href="LICENCES-fr.txt" lang="fr" />
           </simple-license>
       </registration>
    
    • [Optional] the name of the publisher of the extension
       <publisher>
           <name xlink:href="http://www.myorganization/myname" lang="en">ChemicalDict</name>
       </publisher>
    
    • [Optional] an icon that appears in the Extension Manager (do not forget to add the files)
       <icon>
           <default xlink:href="icon.png" />
           <high-contrast xlink:href="icon_hc.png" />
       </icon>
    
    • [Optional] descriptive text that appears in the Extension Manager (do not forget the files)
       <extension-description>
           <src xlink:href="desc_en.txt" lang="en" />
       </extension-description>
    
    * A mandatory final file
    </description>
    

    Additional files (licenses, images, ...) can be grouped into subdirectories.

    Then, assemble the entire content of the directory mydictionary in a ZIP file and change the extension to OXT. That is, your extension is ready, you can install it as any extensions by the Tools ▸ Extensions Manager menu.

    The Creating an extension for dictionaries contains more details.

    Note pin.svg

    Note:
    The dictionary runs in uppercase or lowercase, but will not work in the plural, the conjugated forms, the feminine, etc...