Quasar App Extension i18n-spell-checker
This is a work in process.
This project is independent of the Quasar Framework, but I love Quasar Framework.
i18n-spell-checker is a Quasar App Extension to spell check the text values stored in the i18n files in a typical Quasar Application.
The extension works with the module Nodehun which aims to expose as much of Hunspell's functionality.
To read about Hunspell: Hunspell spell checker.
Donate
If you appreciate the work that went into this App Extension, please consider donating to Quasar.
How the extesion works
The checking process is very simple:
-
The extension opens any one of these files in your Quasar Framework based application:
- <APPLICACTION_ROOT_DIRECTORY>/src/i18n/<LANGUAGE_ID>/index.js
- <APPLICACTION_ROOT_DIRECTORY>/src/i18n/<LANGUAGE_ID>/index.ts
-
Parse the file to compile it to a Javascript Object.
-
Take recursively the text values of each property in the object.
-
Split the text values in words.
-
Check the spelling of each word using Hunspell.
-
Print a colored message with the spelling errors detected.
Install
quasar ext add i18n-spell-checker
Quasar CLI will retrieve it from the NPM registry and install the extension to your project.
Where to get dictionaries
Please, read the nodehum docs in https://www.npmjs.com/package/nodehun#where-to-get-dictionaries
If you are thinking in using Open Office dictionary, please follow this link and read the note: https://www.npmjs.com/package/nodehun#a-note-about-open-office-dictionaries
Extension commands
spellcheck
quasar run i18n-spell-checker spellcheck --language <LANGUAGE> --path <DICTIONARIES_DIRECTORY_PATH>
Examples
-
Check the USA English (en-US) files using the dictionaries (.aff and .dic files) in ../dictionaries
Print the wrong words in red without the line numbers.
quasar run i18n-spell-checker spellcheck --language en-US --path ../dictionaries
-
Check the USA English (en-US) files using the dictionaries (.aff and .dic files) in ../dictionaries
Print line number in the file before the text with the wrong words in red.
quasar run i18n-spell-checker spellcheck --language en-US --path ../dictionaries -n
-
Check the Argentina Spain (es-AR) files using the dictionaries (.aff and .dic files) in ../dictionaries
Print line number in the file before the text with the wrong words in red.
quasar run i18n-spell-checker spellcheck --language es-AR --path ../dictionaries -n
save-dictionary-path
The command save-dictionary-path saves in the Quasar persistent configuration the path to the directory where the dictionaries files (.aff and .dic files) are stored.
You can use this command once to avoid to write the path each time you run the command spellcheck.
quasar run i18n-spell-checker save-dictionary-path --path <DICTIONARIES_DIRECTORY>
Examples
If you run:
quasar run i18n-spell-checker save-dictionary-path --path ~/my_dictionaries
And then:
quasar run i18n-spell-checker spellcheck --language en-US -n
Because the extension knows the path to dictionaries, the previous command is equivalent to run:
quasar run i18n-spell-checker spellcheck --language en-US --path ~/my_dictionaries -n
Uninstall
quasar ext remove i18n-spell-checker
Other Info
You can get help using the -h or --help option in the extension commands. For example:
quasar run i18n-spell-checker spellcheck -h
Donate
If you appreciate the work that went into this App Extension, please consider donating to Quasar.