bajo 1.0.9 → 1.0.11
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/bajo/intl/en-US.json +8 -4
- package/bajo/intl/id.json +8 -3
- package/boot/class/app.js +1 -1
- package/boot/class/bajo-core/helper/build-plugins.js +5 -1
- package/boot/class/bajo-core/method/extract-text.js +6 -5
- package/boot/class/bajo-core/method/get-plugin-file.js +1 -0
- package/boot/class/bajo-core/method/join.js +3 -3
- package/boot/class/bajo-core/method/parse-object.js +2 -7
- package/package.json +1 -1
package/bajo/intl/en-US.json
CHANGED
|
@@ -144,8 +144,12 @@
|
|
|
144
144
|
"stop": "Stop",
|
|
145
145
|
"supportDisabled%s": "%s support is disabled",
|
|
146
146
|
"collect%s": "Collect %s",
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"isRequired%s": "'%s' is required"
|
|
147
|
+
"and": "and",
|
|
148
|
+
"or": "or",
|
|
149
|
+
"none": "none",
|
|
150
|
+
"isRequired%s": "'%s' is required",
|
|
151
|
+
"isDisabled%s": "'%s' is disabled",
|
|
152
|
+
"formSubmitted": "Form Submitted",
|
|
153
|
+
"formSubmittedInfo": "The form you entered has been successfully submitted and is stored securely in our system.",
|
|
154
|
+
"thankYou": "Thank you!"
|
|
151
155
|
}
|
package/bajo/intl/id.json
CHANGED
|
@@ -144,7 +144,12 @@
|
|
|
144
144
|
"stop": "Berhentikan",
|
|
145
145
|
"supportDisabled%s": "Dukungan %s dimatikan",
|
|
146
146
|
"collect%s": "Koleksi %s",
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
147
|
+
"and": "dan",
|
|
148
|
+
"or": "atau",
|
|
149
|
+
"none": "kosong",
|
|
150
|
+
"isRequired%s": "'%s' disyaratkan",
|
|
151
|
+
"isDisabled%s": "'%s' dimatikan",
|
|
152
|
+
"formSubmitted": "Form Terkirim",
|
|
153
|
+
"formSubmittedInfo": "Form yang Anda masukkan telah sukses terkirim dan disimpan dengan aman di sistim kami.",
|
|
154
|
+
"thankYou": "Terima kasih!"
|
|
150
155
|
}
|
package/boot/class/app.js
CHANGED
|
@@ -60,9 +60,9 @@ class App {
|
|
|
60
60
|
await bootPlugins.call(bajo)
|
|
61
61
|
await exitHandler.call(bajo)
|
|
62
62
|
// boot complete
|
|
63
|
-
await bajo.runHook('bajo:bootComplete')
|
|
64
63
|
const elapsed = new Date() - bajo.runAt
|
|
65
64
|
bajo.log.info('bootCompleted%s', bajo.secToHms(elapsed, true))
|
|
65
|
+
await bajo.runHook('bajo:bootComplete')
|
|
66
66
|
if (bajo.applet) await runAsApplet.call(bajo)
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -12,7 +12,11 @@ async function buildPlugins () {
|
|
|
12
12
|
if (fs.existsSync(pluginsFile)) {
|
|
13
13
|
pluginPkgs = pluginPkgs.concat(filter(map(trim(fs.readFileSync(pluginsFile, 'utf8')).split('\n'), p => trim(p)), b => !isEmpty(b)))
|
|
14
14
|
}
|
|
15
|
-
this.pluginPkgs = without(uniq(pluginPkgs), this.mainNs)
|
|
15
|
+
this.pluginPkgs = map(filter(without(uniq(pluginPkgs), this.mainNs), p => {
|
|
16
|
+
return p[0] !== '#'
|
|
17
|
+
}), p => {
|
|
18
|
+
return trim(p.split('#')[0])
|
|
19
|
+
})
|
|
16
20
|
this.pluginPkgs.push(this.mainNs)
|
|
17
21
|
for (const pkg of this.pluginPkgs) {
|
|
18
22
|
const ns = camelCase(pkg)
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
function extractText (text,
|
|
1
|
+
function extractText (text, patternStart, patternEnd) {
|
|
2
2
|
let result = ''
|
|
3
|
-
const open = text.indexOf(
|
|
3
|
+
const open = text.indexOf(patternStart)
|
|
4
4
|
if (open > -1) {
|
|
5
|
-
text = text.slice(open +
|
|
6
|
-
const close = text.indexOf(
|
|
5
|
+
text = text.slice(open + patternStart.length)
|
|
6
|
+
const close = text.indexOf(patternEnd)
|
|
7
7
|
if (close > -1) {
|
|
8
8
|
result = text.slice(0, close)
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
const pattern = `${patternStart}${result}${patternEnd}`
|
|
12
|
+
return { result, pattern }
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export default extractText
|
|
@@ -5,13 +5,13 @@ const { isPlainObject } = lodash
|
|
|
5
5
|
|
|
6
6
|
function join (array, sep) {
|
|
7
7
|
const translate = val => {
|
|
8
|
-
if (this && this.print) return this.print.write(val)
|
|
8
|
+
if (this && this.print) return this.print.write(val).toLowerCase()
|
|
9
9
|
return val
|
|
10
10
|
}
|
|
11
|
-
if (array.length === 0) return translate('
|
|
11
|
+
if (array.length === 0) return translate('none')
|
|
12
12
|
if (array.length === 1) return array[0]
|
|
13
13
|
if (isSet(sep) && !isPlainObject(sep)) return array.join(sep)
|
|
14
|
-
let { separator = ', ', joiner = '
|
|
14
|
+
let { separator = ', ', joiner = 'and' } = sep ?? {}
|
|
15
15
|
joiner = translate(joiner)
|
|
16
16
|
const last = (array.pop() ?? '').trim()
|
|
17
17
|
return array.map(a => (a + '').trim()).join(separator) + ` ${joiner} ${last}`
|
|
@@ -3,7 +3,6 @@ import dotenvParseVariables from 'dotenv-parse-variables'
|
|
|
3
3
|
import ms from 'ms'
|
|
4
4
|
import dayjs from '../../../lib/dayjs.js'
|
|
5
5
|
import isSet from './is-set.js'
|
|
6
|
-
// import translate from '../../../lib/translate.js'
|
|
7
6
|
|
|
8
7
|
const { isPlainObject, isArray, isNumber, set, cloneDeep, isString, omit } = lodash
|
|
9
8
|
const statics = ['*']
|
|
@@ -40,12 +39,8 @@ function parseObject (input, { silent = true, parseValue = false, lang, ns } = {
|
|
|
40
39
|
const newK = k.slice(2)
|
|
41
40
|
if (lang) {
|
|
42
41
|
const scope = ns ? me.app[ns] : me
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (a.slice(0, 2) === 't:') a = scope.print.write(lang, a.slice(2))
|
|
46
|
-
return a
|
|
47
|
-
})
|
|
48
|
-
obj[newK] = scope.print.write(text, lang, ...args)
|
|
42
|
+
const [text, ...args] = v.split('|')
|
|
43
|
+
obj[newK] = scope.print.write(text, ...args, { lang })
|
|
49
44
|
} else obj[newK] = v
|
|
50
45
|
mutated.push(k)
|
|
51
46
|
} else if (parseValue) {
|