adapt-authoring-lang 1.0.0 → 1.0.2
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/.github/workflows/standardjs.yml +13 -0
- package/lib/LangModule.js +2 -2
- package/package.json +1 -2
- package/.eslintignore +0 -1
- package/.eslintrc +0 -14
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name: Standard.js formatting check
|
|
2
|
+
on: push
|
|
3
|
+
jobs:
|
|
4
|
+
default:
|
|
5
|
+
runs-on: ubuntu-latest
|
|
6
|
+
steps:
|
|
7
|
+
- uses: actions/checkout@master
|
|
8
|
+
- uses: actions/setup-node@master
|
|
9
|
+
with:
|
|
10
|
+
node-version: 'lts/*'
|
|
11
|
+
cache: 'npm'
|
|
12
|
+
- run: npm ci
|
|
13
|
+
- run: npx standard
|
package/lib/LangModule.js
CHANGED
|
@@ -149,7 +149,7 @@ class LangModule extends AbstractModule {
|
|
|
149
149
|
if (typeof lang !== 'string') {
|
|
150
150
|
lang = this.getConfig('defaultLang')
|
|
151
151
|
}
|
|
152
|
-
if (key.constructor.name
|
|
152
|
+
if (key.constructor.name.endsWith('Error')) {
|
|
153
153
|
return this.translateError(lang, key)
|
|
154
154
|
}
|
|
155
155
|
const s = this.phrases[lang][key]
|
|
@@ -183,7 +183,7 @@ class LangModule extends AbstractModule {
|
|
|
183
183
|
* @returns The translated error (if passed error is not an instance of AdaptError, the original value will be returned)
|
|
184
184
|
*/
|
|
185
185
|
translateError (lang, error) {
|
|
186
|
-
return error?.constructor
|
|
186
|
+
return error?.constructor.name.endsWith('Error') ? this.translate(lang, `error.${error.code}`, error.data ?? error) : error
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapt-authoring-lang",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"glob": "^11.0.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"eslint": "^9.12.0",
|
|
18
17
|
"standard": "^17.1.0",
|
|
19
18
|
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
20
19
|
"@semantic-release/git": "^10.0.1",
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
node_modules
|