Come installare una selezione personalizzata di dizionari in Sublime Text / How to install a custom selection of dictionaries in Sublime Text

For English version click here

Premessa
La procedura è stata effettuata in Linux Fedora 27 ma gli stessi comandi possono essere utilizzati in altre distribuzioni o, con gli opportuni adattamenti, in altri sistemi operativi.
Apriamo, quindi, il terminale del sistema operativo e andiamo ad iniziare. 
Occorre, prima di tutto, acquisire  i diritti di amministratore utilizzando l'operatore sudo oppure cambiando l'utenza con I'll comando su root
Occorre, inoltre, identificare la cartella dei pacchetti di Sublime Text utilizzando la voce di menu Preferences > Browse Packages.
In Linus Fedora 27 si trovano in 
~/.config/sublime-text-3/Packages
I dizionari installati di default in Sublime Text sono en_GB  e en_US
Si possono visualizzare nella voce di menu View - Dictionary.
Però con questa soluzione avrete una lunghissima serie di dizionari, dall'Armeno dell'Est all'Ucraino.
Lo scopo di questo articolo è quello di limitare l'elenco dei dizionari a quelli che servono effettivamente.

Fase di personalizzazione
Per avere un sottoinsieme di dizionari si può eliminare dalla cartella scaricata i dizionari di uso meno frequente, facendo attenzione che ogni dizionario è presente con 3 FILE con estensione rispettivamente .dic, .aff  e .txt.
Oppure, se l'insieme di dizionari da utilizzare è ridotto (ad esempio inglese, italiano) si può creare un proprio elenco personalizzato partendo da zero.
Ipotizziamo, quindi, di avere necessità soltanto dei dizionari Inglese britannico, Inglese americano e Italiano.
Scarichiamo da https://github.com/titoBouzout/Dictionaries (i dizionari sono open source e tratti da Open Office) i dizionari desiderati, ognuno nelle versioni .dic, .aff e .txt: ad esempio:
  1. Per l'Inglese Britannico
    1. English (British).aff
    2. English (British).dic
    3. English (British).txt
  2. Per l'Inglese Americano
    1. English (American).aff
    2. English (American).dic
    3. English (American).txt
  3. Per l'Italiano
    1. Italian.aff
    2. Italian.dic
    3. Italian.txt
Creiamo una cartella con i dizionari, ad esempio Dictionaries (ma il nome è irrilevante, potete scegliere quello che volete) e copiarla nella cartella che avete identificato all'inizio con il comando 
sudo cp -avr Dictionaries ~/.config/sublime-text-3/Packages/Dictionaries
dove Dictionaries deve corrispondere al percorso della cartella appena creata.
Per visualizzare il risultato aprite il menu View - Dictionary.

Eliminazione dei dizionari già presenti
A questo punto non resta che cancellare l'archivio dei dizionari generato durante l'installazione per evitare doppioni.
Occorre cercare il file Language – English.sublime-package utilizzando locate, eventualmente preceduto da updatedb  per aggiornare l'archivio dei file:

locate 'Language - English.sublime-package'
Notate la presenza indispensabile degli apici intorno al nome file trattando di nome che contiene spazi bianchi.
Il risultato vi fornisce l'indicazione della cartella dove si trova il file da cancellare.
In Linux Fedora si trova in /opt/sublime_text/Packages
A questo punto possiamo cancellare il file originario con il comando

sudo rm /opt/sublime_text/Packages/'Language - English.sublime-package'

Nota conclusiva
Nel caso vogliate aggiungere altri dizionari sarà, ovviamente, sufficiente aggiungere i relativi .aff, .dic e .txt, come sopra scaricati, alla cartella  ~/.config/sublime-text-3/Packages/Dictionaries.

In English

The procedure has been tested in Linux Fedora 27 but the same commands can be used in other distributions or, with the necessary adaptations, in other operating systems.
We then open the operating system terminal and start.
First of all, it is necessary to acquire administrator rights using the sudo operator or changing the user with I'll command on root.
You also need to identify the Sublime Text package folder using the Preferences > Browse Packages menu item.
In Linus Fedora 27 you will find in
~/.config/sublime-text-3/Packages
The dictionaries installed by default in Sublime Text are en_GB and en_US.
You can display them in the View - Dictionary menu item.
However, with this solution you will have a very long series of dictionaries, from the Armenian of the East to the Ukrainian.
The purpose of this article is to limit the list of dictionaries to those that are actually needed.

Customization phase
To have a subset of dictionaries you can delete the less frequently used dictionaries from the downloaded folder, paying attention that each dictionary is present with 3 FILE with extension .dic, .aff and .txt respectively.
Or, if the set of dictionaries to be used is reduced (e. g. English, Italian) you can create your own custom list from scratch.
Let's assume, therefore, that we need only the British English, American English and Italian dictionaries.
We download from https://github.com/titoBouzout/Dictionaries (the dictionaries are open source and taken from Open Office) the dictionaries you want, each in .dic, .aff and .txt: for example:
  1. For British English
    1. English (British).aff
    2. English (British).dic
    3. English (British).txt
  2. For American English
    1. English (American).aff
    2. English (American).dic
    3. English (American).txt
  3. For Italian
    1. Italian.aff
    2. Italian.dic
    3. Italian.txt
Create a folder with dictionaries, for example Dictionaries (but the name is irrelevant, you can choose what you want) and copy it to the folder you identified at the beginning with the command
sudo cp -avr Dictionaries ~/.config/sublime-text-3/Packages/Dictionaries
where Dictionaries must match the path of the newly created folder.
To display the result, open the View - Dictionary menu.

Deleting existing dictionaries
All that remains is to delete the dictionary archive generated during installation to avoid duplication.
You need to search the Language - English. sublime-package using locate, possibly preceded by updatedb to update the file archive:
locate 'Language - English.sublime-package'
Note the essential presence of quotes around the file name by treating it with a name that contains white spaces.
The result gives you an indication of the folder where the file to be deleted is located.
In Linux Fedora is located in /opt/sublime_text/Packages
At this point we can delete the original file with the command:
sudo rm /opt/sublime_text/Packages/' Language - English. sublime-package'

Concluding note
In case you want to add other dictionaries it will, of course, be sufficient to add the  .aff, .dic and .txt files, as above downloaded, to the folder ~/. config/sublime-text-3/Packages/Dictionaries.

Translated with the help of www.DeepL.com/Translator


Commenti

Post popolari in questo blog

PCT e collegamenti ipertestuali tra atti e documenti in Word, Writer e LaTeX

Atti giudiziari: utilizzare le variabili al posto dei nomi propri in Word, Writer e LaTeX

OCR PORTABILE E GRATUITO