This is one of 3 locations where this plugin is publically available. The other 2 are GitHub and Codeberg
A NodeBB plugin to only allow certain languages on your site.
This plugin allows admins to restrict the ability for Topics and Posts to specific languages. This affects all future posts but not retroactively. This will also affect Fediverse posts.
Install
npm install https://codeberg.org/Crakila/nodebb-plugin-language-filter/archive/main.tar.gz
OR
npm install github:Crakila/nodebb-plugin-language-filter
then run ./nodebb build && ./nodebb restart
(I am not confident in publishing this to npm just yet. More info why towards the bottom of this page)
Description
There will be rules in place to determine if a post is accepted or declined.
This will depend on what language(s) you have selected.
The following are the rules set out on Caint.ie where this plugin was initially created for.
The minimum character is for the language detection only. It must be greater than or equal to the minimum post length found in /admin/settings/posts
A post will be ALLOWED if:
- The text is shorter than 10 characters
- The language cannot be determined (returns
und)- The detected language is English (
eng)- The detected language is Irish (
gle)- (Additional languages that can been selected)
A post will be BLOCKED if:
- The text is 10 characters or longer, AND
- The language can be determined, AND
- The detected language is anything other than English or Irish (or whatever language has been selected)
Additional things worth knowing:
- HTML tags are stripped before detection, so formatting does not affect the result
- Detection is based on the post content for replies, and the content or title for new topics
- The language detection is statistical – very short posts that scrape over the 10 character minimum may occasionally be misidentified
- Mixed language posts will be judged on whichever language dominates the text
- Posts where the language genuinely cannot be determined are always let through rather than risk blocking legitimate English content
There is a ‘More Info’ section if you wish to post the above rules into a thread or a post and then link it in the error message (See front-end screenshot below)
Just add a link in (See ACP screenshot) to the thread. It doesn’t even have to be hosted on the same domain.
Screenshots
ACP:
Front-end:
Licence
Licence: WTFPL
See LICENCE.md
Credits & Comment
This is my first plugin/script that I have created to somewhat completion.
I am not a developer, and even with the creation of this plugin, I do not claim to be.
The majority of this plugin was created by Claude Sonnet 4.6 and this README was created entirely by my human hands.
Since this is the first time that I have used AI to create something, I am not confident in uploading it to NPM, so I am keeping it to GitHub & Codeberg for now.
With that in mind, This plugin is using WTFPL for the licence. NodeBB uses GPLv3 – Show them some love <3
PR’s are welcome and appreciated.