This commit is contained in:
Daniël Klabbers 2021-10-27 08:02:07 +02:00
parent 7feec2ffd4
commit 07a1e9dc44
5 changed files with 25 additions and 3 deletions

1
js/admin.ts Normal file
View File

@ -0,0 +1 @@
export * from './src/admin';

2
js/dist/forum.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
js/package-lock.json generated
View File

@ -14,7 +14,7 @@
"flarum-webpack-config": "^1.0.0",
"pusher-js": "^7.0.3",
"webpack": "^4.46.0",
"webpack-cli": "^4.9.0"
"webpack-cli": "^4.9.1"
},
"devDependencies": {
"prettier": "^2.4.1"

21
js/src/admin/index.ts Normal file
View File

@ -0,0 +1,21 @@
import app from 'flarum/forum/app';
app.initializers.add('blomstra-search', (app) => {
const languages = {...['arabic', 'armenian', 'basque', 'bengali', 'brazilian', 'bulgarian', 'catalan', 'cjk', 'czech',
'danish', 'dutch', 'english', 'estonian', 'finnish', 'french', 'galician', 'german', 'greek',
'hindi', 'hungarian', 'indonesian', 'irish', 'italian', 'latvian', 'lithuanian', 'norwegian',
'persian', 'portuguese', 'romanian', 'russian', 'sorani', 'spanish', 'swedish', 'turkish', 'thai']}
app.extensionData
.for('blomstra-search')
.registerSetting(
{
setting: 'blomstra-search.analyzer-language', // This is the key the settings will be saved under in the settings table in the database.
label: app.translator.trans('blomstra-search.admin.analyzer.label'), // The label to be shown letting the admin know what the setting does.
help: app.translator.trans('blomstra-search.admin.analyzer.help'), // Optional help text where a longer explanation of the setting can go.
type: 'select', // What type of setting this is, valid options are: boolean, text (or any other <input> tag type), and select.
options: languages,
default: null,
},
30 // Optional: Priority
)
});