editdb-cli 1.0.3 → 1.0.4
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/README.md +1 -1
- package/package.json +1 -1
- package/src/i18n.js +4 -2
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ editdb ./path/to/your.db
|
|
|
43
43
|
|
|
44
44
|
---
|
|
45
45
|
|
|
46
|
-
For information on setting up your development environment, please read [
|
|
46
|
+
For information on setting up your development environment, please read [CONTRIBUTING.md](docs/CONTRIBUTING.md).
|
|
47
47
|
|
|
48
48
|
## License
|
|
49
49
|
|
package/package.json
CHANGED
package/src/i18n.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
3
4
|
|
|
4
5
|
let translations = {};
|
|
5
6
|
let currentLang = 'en';
|
|
@@ -11,6 +12,7 @@ function resolve(path, obj) {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export async function init(language) {
|
|
15
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
16
|
let lang = language;
|
|
15
17
|
|
|
16
18
|
if (!lang) {
|
|
@@ -25,7 +27,7 @@ export async function init(language) {
|
|
|
25
27
|
currentLang = lang;
|
|
26
28
|
|
|
27
29
|
try {
|
|
28
|
-
const filePath = path.resolve(
|
|
30
|
+
const filePath = path.resolve(__dirname, `../locales/${currentLang}.json`);
|
|
29
31
|
const fileContent = await fs.readFile(filePath, 'utf-8');
|
|
30
32
|
translations = JSON.parse(fileContent);
|
|
31
33
|
} catch (error) {
|
|
@@ -33,7 +35,7 @@ export async function init(language) {
|
|
|
33
35
|
`Could not load translations for '${currentLang}'. Falling back to English.`
|
|
34
36
|
);
|
|
35
37
|
currentLang = 'en';
|
|
36
|
-
const filePath = path.resolve(
|
|
38
|
+
const filePath = path.resolve(__dirname, `../locales/en.json`);
|
|
37
39
|
const fileContent = await fs.readFile(filePath, 'utf-8');
|
|
38
40
|
translations = JSON.parse(fileContent);
|
|
39
41
|
}
|