FredKruse / writingtool

WritingTool for libreOffice based on LanguageTool
GNU Lesser General Public License v2.1
8 stars 0 forks source link

[pt-PT] Allow pre- and -post language agreement — 2024-07-21 #6

Closed marcoagpinto closed 3 weeks ago

marcoagpinto commented 1 month ago

Heya, @FredKruse ,

Could this feature be implemented?

pt-pt_20240721

“AO” means “Acordo Ortográfico” (“Orthographic Agreement”) and we have the one from 1945 (before the agreement) and the one from 1990 (after the agreement).

My idea is this: o AO1945

  1. Disable category:
    <category id="AO90_RULES_PT_PT" name="[pt-PT] Regras do Acordo Ortográfico de 90 (pós-AO90)" type="misspelling" default='on'>
  2. Enable category: <category id="AO45_RULES_PT_PT" name="[pt-PT][AO45] Regras do Acordo Ortográfico de 45 (pré-AO90)" type="misspelling" default='off'>
  3. Enable dictionary: pt_PT_45.aff + pt_PT_45.dic

o AO1990 (default)

  1. Enable category:
    <category id="AO90_RULES_PT_PT" name="[pt-PT] Regras do Acordo Ortográfico de 90 (pós-AO90)" type="misspelling" default='on'>
  2. Disable category: <category id="AO45_RULES_PT_PT" name="[pt-PT][AO45] Regras do Acordo Ortográfico de 45 (pré-AO90)" type="misspelling" default='off'>
  3. Enable dictionary: pt_PT_90.aff + pt_PT_90.dic

Is it doable?

Thanks!

FredKruse commented 1 month ago

The activation/deactivation of categories can be controlled via the extension. Switching between different dictionaries is a matter for the LanguageTool core. I think it would be easier if you defined two language variants (old/new variant), which can then be switched via the option dialog.

marcoagpinto commented 1 month ago

Heya, @FredKruse ,

I am confused. Is it possible for you to toggle both dictionaries (AO45 and AO90) from the extension?

Thanks!

FredKruse commented 1 month ago

Hi @marcoagpinto, The extension works like this: The grammar and spell checkers work separately:

  1. Grammar check:
    • You can set the default value. Then the language that is assigned to the respective paragraph in the document is used.
    • A fixed language is set, then this language is used for the entire check of the document. In both cases, the dictionary is used by individual functions in the background. I cannot influence this from the extension.
  2. Spell check: The LT spell checker is used in addition to the LO spell checker (LO supports several such services). This has the advantage that words, that are recognized as correct by one of the two checkers, are not marked as errors. This applies to additional dictionaries from LT as well as to private dictionaries from LO. LO uses the language that it is set to for each word. The extension has always passed this on so far. Here, one could also consider a mechanism that overwrites the LO default when a fixed language is set (has not yet been implemented and would only apply to the LT spell checker - not to the parallel LO one).

In both cases, however, a language would have to be defined within LT that corresponds to the old standard. Then the extension could also take this into account.