fix(server): permit to register new spellings for other languages than en#156
Merged
mdevolde merged 1 commit intojxmorris12:masterfrom Mar 7, 2026
Merged
Conversation
2fd978d to
86e585d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes LanguageTool(new_spellings=...) so custom spellings are registered in the LanguageTool resource directory matching the tool’s configured language (instead of being hard-coded to English), enabling non-English custom dictionaries.
Changes:
- Initialize
self._languagebefore registeringnew_spellings. - Compute
spelling.txtpath using the instance language’s resource directory rather than/en/.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
86e585d to
b2ed52f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(server): permit to register new spellings for other languages than en
Why the pull request was made
To fix a bug that restrict the addition of words to english.
If you give
new_spellingstoLanguageToolwith, for exemple,esas language, thenew_spellingswill be added in the english dict, and so, the custom words will not be taken into acount.Summary of changes
language_tool_python.server.LanguageTool._get_valid_spelling_file_path, find the spelling file depending on the language of the current server.Screenshots (if appropriate):
Not applicable.
How has this been tested?
By applying local tests, and by testing to add accepted words in some languages.
Resources
This commit on the fork of @vfigueroa-nur allowed me to detect this bug.
Types of changes
Checklist