mimi-seed 0.21.3 → 0.21.5
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.
|
@@ -14,13 +14,26 @@ import path3 from "path";
|
|
|
14
14
|
import fs from "fs";
|
|
15
15
|
import os from "os";
|
|
16
16
|
import path from "path";
|
|
17
|
-
var DEFAULT_LANG = "
|
|
17
|
+
var DEFAULT_LANG = "en";
|
|
18
18
|
function isLang(v) {
|
|
19
19
|
return v === "ko" || v === "en";
|
|
20
20
|
}
|
|
21
21
|
function settingsPath(home = os.homedir()) {
|
|
22
22
|
return path.join(home, ".mimi-seed", "settings.json");
|
|
23
23
|
}
|
|
24
|
+
function systemLang(env = process.env) {
|
|
25
|
+
for (const key of ["LC_ALL", "LC_MESSAGES", "LANG"]) {
|
|
26
|
+
const value = env[key]?.trim();
|
|
27
|
+
if (!value) continue;
|
|
28
|
+
if (/^(?:C|POSIX)(?:[._@]|$)/i.test(value)) return DEFAULT_LANG;
|
|
29
|
+
return /^ko(?:[_.@-]|$)/i.test(value) ? "ko" : "en";
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
return /^ko(?:-|$)/i.test(Intl.DateTimeFormat().resolvedOptions().locale) ? "ko" : "en";
|
|
33
|
+
} catch {
|
|
34
|
+
return DEFAULT_LANG;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
24
37
|
function resolveLang(home = os.homedir()) {
|
|
25
38
|
const env = process.env.MIMI_SEED_LANG?.toLowerCase();
|
|
26
39
|
if (isLang(env)) return env;
|
|
@@ -29,7 +42,7 @@ function resolveLang(home = os.homedir()) {
|
|
|
29
42
|
if (isLang(saved)) return saved;
|
|
30
43
|
} catch {
|
|
31
44
|
}
|
|
32
|
-
return
|
|
45
|
+
return systemLang();
|
|
33
46
|
}
|
|
34
47
|
|
|
35
48
|
// ../core/src/project-manifest.ts
|
|
@@ -796,7 +809,7 @@ var en = {
|
|
|
796
809
|
checkWith: "Check with: mimi-seed doctor"
|
|
797
810
|
},
|
|
798
811
|
lang: {
|
|
799
|
-
ask: " Choose a language [1] \uD55C\uAD6D\uC5B4 [2] English (Enter =
|
|
812
|
+
ask: " Choose a language [1] \uD55C\uAD6D\uC5B4 [2] English (Enter = English): ",
|
|
800
813
|
saved: (l) => ` \u2705 Language: ${l === "ko" ? "\uD55C\uAD6D\uC5B4" : "English"} (change later: mimi-seed lang ko)`,
|
|
801
814
|
usage: `mimi-seed lang \u2014 CLI output language
|
|
802
815
|
|
|
@@ -896,7 +909,7 @@ function t() {
|
|
|
896
909
|
}
|
|
897
910
|
|
|
898
911
|
// package.json
|
|
899
|
-
var version = "0.21.
|
|
912
|
+
var version = "0.21.5";
|
|
900
913
|
|
|
901
914
|
// src/lib/windows-path.ts
|
|
902
915
|
import path4 from "path";
|
|
@@ -2789,7 +2802,8 @@ function printObtain(spec) {
|
|
|
2789
2802
|
async function ensureLangChosen() {
|
|
2790
2803
|
if (!isLangUnset()) return;
|
|
2791
2804
|
const answer = await ask(t().lang.ask);
|
|
2792
|
-
const
|
|
2805
|
+
const choice = answer.trim().toLowerCase();
|
|
2806
|
+
const lang = choice === "1" || choice === "ko" ? "ko" : choice === "2" || choice === "en" ? "en" : resolveLang();
|
|
2793
2807
|
writeSettings({ lang });
|
|
2794
2808
|
process.env.MIMI_SEED_LANG = lang;
|
|
2795
2809
|
log2(kleur2.green(t().lang.saved(lang)));
|