ilius / pyglossary

A tool for converting dictionary files aka glossaries. Mainly to help use our offline glossaries in any Open Source dictionary we like on any modern operating system / device.
GNU General Public License v3.0
2.19k stars 238 forks source link

DSL: support abbreviations #426

Open Foxtrod89 opened 1 year ago

Foxtrod89 commented 1 year ago

Is your feature request related to a problem? Please describe. As you probably heard DSL supports abbreviation dictionary to display full description of abbreviation.

Describe the solution you'd like Apple's Leopard Dictionary supports it as well.

Provide links and sample file(s) dsl's tag for abbreviations [p], [/p] – labels (clicking a label displays its full text)

dsl file content

NAME "Longman DOCE 5 (En-En) Abbrevs"

INDEX_LANGUAGE "English"

CONTENTS_LANGUAGE "English"

pl plural

n noun

C countable

adj. adj adjective

adv. adverb

conj. conjunction

def.art. definite article

soshial commented 1 year ago

Almost every dictionary has abbreviations and usually those are viewable as tooltips on hover? Is this information convertable between different formats?

Here's a demonstration of abbreviation tooltip in ABBYY Lingvo: image

This might be implemented with CSS :hover attribute. DSL File with abbreviations is usually included: https://github.com/Tvangeste/SampleDSL/blob/c910f190cd1da80158f717c5df9200c8388fd30c/sample_abrv.dsl

soshial commented 10 months ago

Found another example in a StarDict glossary:

Screenshot 2023-11-04 at 11 36 45 Screenshot 2023-11-04 at 11 38 07

The function seto() looked like this:

function seto(o, show) {
    var s = o.getElementsByTagName("small")[0];
    if (show === false) {
        s.style.display = 'none';
        return false;
    }
    if (s.offsetWidth > 200) {
        if ((o.offsetLeft + 200) > document.body.offsetWidth) {
            s.style.left = o.offsetLeft - ((o.offsetLeft + 200) - document.body.offsetWidth) + 'px';
        } else {
            s.style.left = o.offsetLeft + 'px';
        }
    } else {
        if ((o.offsetLeft + s.offsetWidth) > document.body.offsetWidth) {
            s.style.left = o.offsetLeft - ((o.offsetLeft + s.offsetWidth) - document.body.offsetWidth) + 'px';
        } else {
            s.style.left = o.offsetLeft + 'px';
        }
    }
    s.style.display = 'block';
}