Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
server: Add endpoint to get list of locales
Elian Doran51afb63e25b4
diff --git a/src/routes/api/options.ts b/src/routes/api/options.tsindex 2113746baa..d7ea7520ae 100644--- a/src/routes/api/options.ts+++ b/src/routes/api/options.ts@@ -129,6 +129,20 @@ function getUserThemes() {return ret;}+function getSupportedLocales() {+ // TODO: Currently hardcoded, needs to read the lits of available languages.+ return [+ {+ "id": "en",+ "name": "English"+ },+ {+ "id": "cn",+ "name": "Chinese"+ }+ ];+}+function isAllowed(name: string) {return ALLOWED_OPTIONS.has(name)|| name.startsWith("keyboardShortcuts")@@ -140,5 +154,6 @@ export default {getOptions,updateOption,updateOptions,- getUserThemes+ getUserThemes,+ getSupportedLocales};diff --git a/src/routes/routes.ts b/src/routes/routes.tsindex 5a3e181c54..e808c1e0d6 100644--- a/src/routes/routes.ts+++ b/src/routes/routes.ts@@ -217,6 +217,7 @@ function register(app: express.Application) {apiRoute(PUT, '/api/options/:name/:value*', optionsApiRoute.updateOption);apiRoute(PUT, '/api/options', optionsApiRoute.updateOptions);apiRoute(GET, '/api/options/user-themes', optionsApiRoute.getUserThemes);+ apiRoute(GET, '/api/options/locales', optionsApiRoute.getSupportedLocales);apiRoute(PST, '/api/password/change', passwordApiRoute.changePassword);apiRoute(PST, '/api/password/reset', passwordApiRoute.resetPassword);