anyproto / anytype-ts

Official Anytype client for MacOS, Linux, and Windows
https://anytype.io
Other
3.64k stars 215 forks source link

Add Dictionary Management and Multi-Language Support #727

Open n0one42 opened 1 month ago

n0one42 commented 1 month ago

Have you read a contributing guide?

Clear and concise description of the problem

  1. Dictionary Management Menu:

    • View Dictionary Entries: Add a menu option to view all dictionary entries.
    • Edit Dictionary Entries: Allow users to edit existing dictionary entries.
    • Remove Dictionary Entries: Enable users to remove words from the dictionary.
  2. Multi-Language Support:

    • Language Selection: Provide an option to select the language for the dictionary.
    • Language-Specific Dictionaries: Maintain separate dictionaries for each language selected.
    • Auto-Detect Language: Implement a feature to auto-detect the language of the text being entered and use the appropriate dictionary.

Suggested solution

  1. Dictionary Management Menu:

    • View Dictionary Entries: Add a menu option to view all dictionary entries.
    • Edit Dictionary Entries: Allow users to edit existing dictionary entries.
    • Remove Dictionary Entries: Enable users to remove words from the dictionary.
  2. Multi-Language Support:

    • Language Selection: Provide an option to select the language for the dictionary.
    • Language-Specific Dictionaries: Maintain separate dictionaries for each language selected.
    • Auto-Detect Language: Implement a feature to auto-detect the language of the text being entered and use the appropriate dictionary.

Alternative

No response

Additional context

Justification:

Impact:

Thank you for considering this enhancement request. I believe these features will significantly improve the functionality and usability of the Anytype app.

n0one42 commented 1 month ago

Maybe this could help as an Idea:

sudo pacman -S hunspell hunspell-en_us hunspell-de

spellCheckConfig.js

const spellchecker = require('spellchecker');

// Function to initialize dictionaries
function initSpellChecker() {
  spellchecker.setDictionary('en_US', '/usr/share/hunspell/en_US.aff', '/usr/share/hunspell/en_US.dic');
  spellchecker.setDictionary('de_DE', '/usr/share/hunspell/de_DE.aff', '/usr/share/hunspell/de_DE.dic');
}

// Function to switch spell check language
function setSpellCheckLanguage(language) {
  switch (language) {
    case 'en':
      spellchecker.setDictionary('en_US', '/usr/share/hunspell/en_US.aff', '/usr/share/hunspell/en_US.dic');
      break;
    case 'de':
      spellchecker.setDictionary('de_DE', '/usr/share/hunspell/de_DE.aff', '/usr/share/hunspell/de_DE.dic');
      break;
    default:
      console.error('Unsupported language');
  }
}

module.exports = {
  initSpellChecker,
  setSpellCheckLanguage
};
n0one42 commented 1 month ago

I found out that there is an ~/.config/anytype/Dictionaries/ folder. However, adding an additional dictionary did not did what it should. Renaming my dictionary the same name as the en-US one, did work which means it must be coded somewhere to always use only the en-US-10-1.bdic. Pls implement at least a dropdown or such to select the wanted dict. Multi Dicts would be still greater.

iamWing commented 1 month ago

Second on the dictionary management. Think it's more of a priority that if you allow users to add custom words to the dictionary then there needs to be a way to remove the custom words added as well.