adapt-authoring-lang 1.2.5 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/LangModule.js +6 -21
- package/package.json +3 -2
- package/routes.json +23 -0
package/lib/LangModule.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AbstractModule } from 'adapt-authoring-core'
|
|
2
|
-
import
|
|
2
|
+
import { loadRouteConfig, registerRoutes } from 'adapt-authoring-server'
|
|
3
|
+
import fs from 'node:fs/promises'
|
|
3
4
|
import { glob } from 'glob'
|
|
4
|
-
import path from 'path'
|
|
5
|
+
import path from 'node:path'
|
|
5
6
|
import { storeStrings, translate, translateError } from './utils.js'
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -75,25 +76,9 @@ class LangModule extends AbstractModule {
|
|
|
75
76
|
|
|
76
77
|
server.api.addMiddleware(this.addTranslationUtils.bind(this))
|
|
77
78
|
|
|
78
|
-
const
|
|
79
|
-
router.
|
|
80
|
-
|
|
81
|
-
handlers: { get: this.requestHandler.bind(this) },
|
|
82
|
-
meta: {
|
|
83
|
-
get: {
|
|
84
|
-
summary: 'Retrieve lang strings for single locale',
|
|
85
|
-
responses: {
|
|
86
|
-
200: {
|
|
87
|
-
description: 'Lang strings for the specified locale',
|
|
88
|
-
content: {
|
|
89
|
-
'application/json': {}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
auth.unsecureRoute(router.path, 'get')
|
|
79
|
+
const config = await loadRouteConfig(this.rootDir, this)
|
|
80
|
+
const router = server.api.createChildRouter(config.root)
|
|
81
|
+
registerRoutes(router, config.routes, auth)
|
|
97
82
|
}
|
|
98
83
|
|
|
99
84
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapt-authoring-lang",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Localisation for the Adapt authoring tool",
|
|
5
5
|
"homepage": "https://github.com/taylortom/adapt-authoring-lang",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"adapt-authoring-auth": "^2.0.0",
|
|
22
|
-
"adapt-authoring-server": "^2.
|
|
22
|
+
"adapt-authoring-server": "^2.1.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"adapt-authoring-server": "^2.1.0",
|
|
25
26
|
"@semantic-release/git": "^10.0.1",
|
|
26
27
|
"conventional-changelog-eslint": "^6.0.0",
|
|
27
28
|
"semantic-release": "^25.0.2",
|
package/routes.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": "lang",
|
|
3
|
+
"routes": [
|
|
4
|
+
{
|
|
5
|
+
"route": "/{:lang}",
|
|
6
|
+
"handlers": { "get": "requestHandler" },
|
|
7
|
+
"permissions": { "get": null },
|
|
8
|
+
"meta": {
|
|
9
|
+
"get": {
|
|
10
|
+
"summary": "Retrieve lang strings for single locale",
|
|
11
|
+
"responses": {
|
|
12
|
+
"200": {
|
|
13
|
+
"description": "Lang strings for the specified locale",
|
|
14
|
+
"content": {
|
|
15
|
+
"application/json": {}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|