@memoryblock/locale 0.1.0-beta
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/LICENSE +21 -0
- package/dist/en.d.ts +175 -0
- package/dist/en.d.ts.map +1 -0
- package/dist/en.js +188 -0
- package/dist/en.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/package.json +17 -0
- package/src/en.ts +203 -0
- package/src/index.ts +48 -0
- package/tsconfig.json +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 memoryblock
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/en.d.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* English locale — default language for memoryblock.
|
|
3
|
+
*
|
|
4
|
+
* To add a new language:
|
|
5
|
+
* 1. Copy this file to `<lang>.ts` (e.g., `fr.ts`, `ja.ts`)
|
|
6
|
+
* 2. Translate all string values (keep function signatures identical)
|
|
7
|
+
* 3. Register in `index.ts`
|
|
8
|
+
*
|
|
9
|
+
* Template strings use function params for dynamic values.
|
|
10
|
+
* Keep the exact same param names and types.
|
|
11
|
+
*/
|
|
12
|
+
export declare const en: {
|
|
13
|
+
general: {
|
|
14
|
+
notInitialized: string;
|
|
15
|
+
noBlocksDir: string;
|
|
16
|
+
noBlocksFound: string;
|
|
17
|
+
};
|
|
18
|
+
block: {
|
|
19
|
+
notFound: (name: string) => string;
|
|
20
|
+
alreadyExists: (name: string, path: string) => string;
|
|
21
|
+
alreadyRunning: (name: string) => string;
|
|
22
|
+
singleInstanceHint: string;
|
|
23
|
+
stopHint: (name: string) => string;
|
|
24
|
+
staleLockRecovered: string;
|
|
25
|
+
created: (name: string) => string;
|
|
26
|
+
startWith: (name: string) => string;
|
|
27
|
+
invalidName: string;
|
|
28
|
+
createdConfig: string;
|
|
29
|
+
createdPulse: string;
|
|
30
|
+
createdMemory: string;
|
|
31
|
+
createdMonitor: string;
|
|
32
|
+
path: (path: string) => string;
|
|
33
|
+
};
|
|
34
|
+
monitor: {
|
|
35
|
+
shuttingDown: string;
|
|
36
|
+
goingToSleep: string;
|
|
37
|
+
currentSession: string;
|
|
38
|
+
completeSession: string;
|
|
39
|
+
online: string;
|
|
40
|
+
memoryThreshold: string;
|
|
41
|
+
error: (msg: string) => string;
|
|
42
|
+
};
|
|
43
|
+
status: {
|
|
44
|
+
noActive: string;
|
|
45
|
+
archived: (count: number) => string;
|
|
46
|
+
restoreHint: string;
|
|
47
|
+
invalidConfig: string;
|
|
48
|
+
};
|
|
49
|
+
stop: {
|
|
50
|
+
noBlocksDir: string;
|
|
51
|
+
noActive: string;
|
|
52
|
+
notFound: (name: string) => string;
|
|
53
|
+
alreadySleeping: (name: string) => string;
|
|
54
|
+
stoppedDaemon: (name: string) => string;
|
|
55
|
+
stopped: (name: string) => string;
|
|
56
|
+
};
|
|
57
|
+
archive: {
|
|
58
|
+
success: (name: string) => string;
|
|
59
|
+
location: (path: string) => string;
|
|
60
|
+
restoreCmd: (name: string) => string;
|
|
61
|
+
deleteCmd: (name: string) => string;
|
|
62
|
+
hardDeleteSuccess: (name: string) => string;
|
|
63
|
+
hardDeleteArchiveSuccess: (name: string) => string;
|
|
64
|
+
mustUseHard: string;
|
|
65
|
+
notFoundBlock: (name: string) => string;
|
|
66
|
+
notFoundArchive: (name: string) => string;
|
|
67
|
+
notFoundEither: (name: string) => string;
|
|
68
|
+
multipleFound: (name: string) => string;
|
|
69
|
+
restoreSuccess: (name: string) => string;
|
|
70
|
+
restoreConflict: (name: string) => string;
|
|
71
|
+
};
|
|
72
|
+
setup: {
|
|
73
|
+
title: (name: string) => string;
|
|
74
|
+
needsConfig: string;
|
|
75
|
+
configMethod: string;
|
|
76
|
+
copyFrom: (name: string, detail: string) => string;
|
|
77
|
+
startFresh: string;
|
|
78
|
+
startFreshHint: string;
|
|
79
|
+
selectProvider: string;
|
|
80
|
+
selectModel: string;
|
|
81
|
+
fetchingModels: (provider: string) => string;
|
|
82
|
+
noModelsFound: string;
|
|
83
|
+
skillsPlugins: string;
|
|
84
|
+
selectSkills: string;
|
|
85
|
+
configComplete: string;
|
|
86
|
+
cancelledSetup: string;
|
|
87
|
+
copiedSettings: (source: string) => string;
|
|
88
|
+
};
|
|
89
|
+
init: {
|
|
90
|
+
welcome: string;
|
|
91
|
+
selectProvider: string;
|
|
92
|
+
enterApiKey: (key: string) => string;
|
|
93
|
+
verifyingConnection: string;
|
|
94
|
+
connectionSuccess: string;
|
|
95
|
+
connectionFailed: string;
|
|
96
|
+
selectChannel: string;
|
|
97
|
+
selectPlugins: string;
|
|
98
|
+
firstBlockName: string;
|
|
99
|
+
setupComplete: string;
|
|
100
|
+
};
|
|
101
|
+
plugins: {
|
|
102
|
+
header: string;
|
|
103
|
+
installed: string;
|
|
104
|
+
available: string;
|
|
105
|
+
added: (name: string) => string;
|
|
106
|
+
removed: (name: string) => string;
|
|
107
|
+
installerNotAvailable: string;
|
|
108
|
+
installerNotAvailableShort: string;
|
|
109
|
+
specifyId: string;
|
|
110
|
+
installing: (id: string) => string;
|
|
111
|
+
removing: (id: string) => string;
|
|
112
|
+
noConfigurable: string;
|
|
113
|
+
runSettings: string;
|
|
114
|
+
pluginNotFound: (id: string) => string;
|
|
115
|
+
noSettings: (name: string) => string;
|
|
116
|
+
};
|
|
117
|
+
permissions: {
|
|
118
|
+
scopeBlock: string;
|
|
119
|
+
scopeWorkspace: string;
|
|
120
|
+
scopeSystem: string;
|
|
121
|
+
invalidScope: (scope: string) => string;
|
|
122
|
+
updated: (name: string) => string;
|
|
123
|
+
};
|
|
124
|
+
server: {
|
|
125
|
+
alreadyRunning: (pid: number, port?: string) => string;
|
|
126
|
+
startedDaemon: (pid: number) => string;
|
|
127
|
+
daemonStopHint: string;
|
|
128
|
+
daemonFailed: string;
|
|
129
|
+
failedToLoad: (msg: string) => string;
|
|
130
|
+
webUiNotFound: string;
|
|
131
|
+
running: string;
|
|
132
|
+
serverFailed: (msg: string) => string;
|
|
133
|
+
stoppedPort: (port: string | number) => string;
|
|
134
|
+
noPidFound: string;
|
|
135
|
+
stalePid: string;
|
|
136
|
+
stopped: (pid: number) => string;
|
|
137
|
+
processGone: string;
|
|
138
|
+
stopFailed: (msg: string) => string;
|
|
139
|
+
statusNotRunning: string;
|
|
140
|
+
statusRunning: string;
|
|
141
|
+
statusStalePid: string;
|
|
142
|
+
url: (port: string | number) => string;
|
|
143
|
+
};
|
|
144
|
+
lifecycle: {
|
|
145
|
+
stoppingBlocks: string;
|
|
146
|
+
stoppingServer: string;
|
|
147
|
+
everythingStopped: string;
|
|
148
|
+
startingServer: string;
|
|
149
|
+
};
|
|
150
|
+
channels: {
|
|
151
|
+
cli: {
|
|
152
|
+
helpLine1: string;
|
|
153
|
+
helpLine2: string;
|
|
154
|
+
};
|
|
155
|
+
telegram: {
|
|
156
|
+
isOnline: (name: string) => string;
|
|
157
|
+
isOffline: (name: string) => string;
|
|
158
|
+
anotherInstance: string;
|
|
159
|
+
anotherRunning: string;
|
|
160
|
+
botError: (msg: string) => string;
|
|
161
|
+
pollingStopped: (msg: string) => string;
|
|
162
|
+
noToken: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
errors: {
|
|
166
|
+
unexpected: (msg: string) => string;
|
|
167
|
+
failedToLoad: (what: string, msg: string) => string;
|
|
168
|
+
failedToDelete: (msg: string) => string;
|
|
169
|
+
failedToArchive: (msg: string) => string;
|
|
170
|
+
failedToRestore: (msg: string) => string;
|
|
171
|
+
monitorFailed: (msg: string) => string;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
export type Locale = typeof en;
|
|
175
|
+
//# sourceMappingURL=en.d.ts.map
|
package/dist/en.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../src/en.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,EAAE;;;;;;;yBAWU,MAAM;8BACD,MAAM,QAAQ,MAAM;+BACnB,MAAM;;yBAEZ,MAAM;;wBAEP,MAAM;0BACJ,MAAM;;;;;;qBAMX,MAAM;;;;;;;;;qBAWN,MAAM;;;;0BAMD,MAAM;;;;;;;yBASP,MAAM;gCACC,MAAM;8BACR,MAAM;wBACZ,MAAM;;;wBAKN,MAAM;yBACL,MAAM;2BACJ,MAAM;0BACP,MAAM;kCACE,MAAM;yCACC,MAAM;;8BAEjB,MAAM;gCACJ,MAAM;+BACP,MAAM;8BACP,MAAM;+BACL,MAAM;gCACL,MAAM;;;sBAKhB,MAAM;;;yBAGH,MAAM,UAAU,MAAM;;;;;mCAKZ,MAAM;;;;;;iCAMR,MAAM;;;;;2BAOZ,MAAM;;;;;;;;;;;;;sBAeX,MAAM;wBACJ,MAAM;;;;yBAIL,MAAM;uBACR,MAAM;;;6BAGA,MAAM;2BACR,MAAM;;;;;;8BAQH,MAAM;wBACZ,MAAM;;;8BAKA,MAAM,SAAS,MAAM;6BACtB,MAAM;;;4BAGP,MAAM;;;4BAGN,MAAM;4BACN,MAAM,GAAG,MAAM;;;uBAGpB,MAAM;;0BAEH,MAAM;;;;oBAIZ,MAAM,GAAG,MAAM;;;;;;;;;;;;;;6BAkBN,MAAM;8BACL,MAAM;;;4BAGR,MAAM;kCACA,MAAM;;;;;0BAOd,MAAM;6BACH,MAAM,OAAO,MAAM;8BAClB,MAAM;+BACL,MAAM;+BACN,MAAM;6BACR,MAAM;;CAElC,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,OAAO,EAAE,CAAC"}
|
package/dist/en.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* English locale — default language for memoryblock.
|
|
3
|
+
*
|
|
4
|
+
* To add a new language:
|
|
5
|
+
* 1. Copy this file to `<lang>.ts` (e.g., `fr.ts`, `ja.ts`)
|
|
6
|
+
* 2. Translate all string values (keep function signatures identical)
|
|
7
|
+
* 3. Register in `index.ts`
|
|
8
|
+
*
|
|
9
|
+
* Template strings use function params for dynamic values.
|
|
10
|
+
* Keep the exact same param names and types.
|
|
11
|
+
*/
|
|
12
|
+
export const en = {
|
|
13
|
+
// ─── General ────────────────────────────────────
|
|
14
|
+
general: {
|
|
15
|
+
notInitialized: 'Not initialized. Run `mblk init` first.',
|
|
16
|
+
noBlocksDir: 'No blocks directory found. Create a block with `mblk create <name>`.',
|
|
17
|
+
noBlocksFound: 'No blocks found. Create one with `mblk create <name>`.',
|
|
18
|
+
},
|
|
19
|
+
// ─── Block Lifecycle ────────────────────────────
|
|
20
|
+
block: {
|
|
21
|
+
notFound: (name) => `Block "${name}" not found. Run \`mblk create ${name}\` first.`,
|
|
22
|
+
alreadyExists: (name, path) => `Block "${name}" already exists at ${path}`,
|
|
23
|
+
alreadyRunning: (name) => `Block "${name}" is already running.`,
|
|
24
|
+
singleInstanceHint: 'Each block can only run as one instance at a time.',
|
|
25
|
+
stopHint: (name) => `Stop it first with: mblk stop ${name}`,
|
|
26
|
+
staleLockRecovered: 'Recovered from stale lock (previous session crashed).',
|
|
27
|
+
created: (name) => `Block "${name}" created.`,
|
|
28
|
+
startWith: (name) => `Start with: mblk start ${name}`,
|
|
29
|
+
invalidName: 'Block name must start with a letter/number and contain only lowercase letters, numbers, and hyphens (max 32 chars).',
|
|
30
|
+
createdConfig: 'Created config.json',
|
|
31
|
+
createdPulse: 'Created pulse.json',
|
|
32
|
+
createdMemory: 'Created memory.md',
|
|
33
|
+
createdMonitor: 'Created monitor.md',
|
|
34
|
+
path: (path) => `Path: ${path}`,
|
|
35
|
+
},
|
|
36
|
+
// ─── Monitor ────────────────────────────────────
|
|
37
|
+
monitor: {
|
|
38
|
+
shuttingDown: 'Shutting down...',
|
|
39
|
+
goingToSleep: 'Going to sleep.',
|
|
40
|
+
currentSession: 'Current Session',
|
|
41
|
+
completeSession: 'Complete Session',
|
|
42
|
+
online: 'Online. Listening...',
|
|
43
|
+
memoryThreshold: 'Memory threshold. Smart-saving context...',
|
|
44
|
+
error: (msg) => `Monitor error: ${msg}`,
|
|
45
|
+
},
|
|
46
|
+
// ─── Status ─────────────────────────────────────
|
|
47
|
+
status: {
|
|
48
|
+
noActive: 'No active blocks.',
|
|
49
|
+
archived: (count) => `📦 ${count} archived`,
|
|
50
|
+
restoreHint: 'Restore with: mblk restore <name>',
|
|
51
|
+
invalidConfig: 'invalid config',
|
|
52
|
+
},
|
|
53
|
+
// ─── Stop ───────────────────────────────────────
|
|
54
|
+
stop: {
|
|
55
|
+
noBlocksDir: 'No blocks directory found. Nothing to stop.',
|
|
56
|
+
noActive: 'No active blocks to stop.',
|
|
57
|
+
notFound: (name) => `Block "${name}" not found.`,
|
|
58
|
+
alreadySleeping: (name) => `${name}: already sleeping`,
|
|
59
|
+
stoppedDaemon: (name) => `${name}: stopped (daemon process killed)`,
|
|
60
|
+
stopped: (name) => `${name}: stopped`,
|
|
61
|
+
},
|
|
62
|
+
// ─── Delete / Archive / Restore ─────────────────
|
|
63
|
+
archive: {
|
|
64
|
+
success: (name) => `Block "${name}" archived safely.`,
|
|
65
|
+
location: (path) => `Location: ${path}`,
|
|
66
|
+
restoreCmd: (name) => `To restore: mblk restore ${name}`,
|
|
67
|
+
deleteCmd: (name) => `To permanently delete: mblk delete ${name} --hard`,
|
|
68
|
+
hardDeleteSuccess: (name) => `"${name}" permanently deleted.`,
|
|
69
|
+
hardDeleteArchiveSuccess: (name) => `"${name}" permanently deleted from archive.`,
|
|
70
|
+
mustUseHard: 'Archived blocks must be deleted permanently using the --hard flag.',
|
|
71
|
+
notFoundBlock: (name) => `Block "${name}" not found. Run \`mblk status\` to see available blocks.`,
|
|
72
|
+
notFoundArchive: (name) => `No archive found for "${name}". Run \`mblk status\` to check archives.`,
|
|
73
|
+
notFoundEither: (name) => `Block or archive "${name}" not found.`,
|
|
74
|
+
multipleFound: (name) => `Multiple archives found for "${name}". Which one?`,
|
|
75
|
+
restoreSuccess: (name) => `Block "${name}" restored successfully.`,
|
|
76
|
+
restoreConflict: (name) => `Cannot restore: A block named "${name}" already exists. Delete or rename it first.`,
|
|
77
|
+
},
|
|
78
|
+
// ─── Onboarding / Setup ─────────────────────────
|
|
79
|
+
setup: {
|
|
80
|
+
title: (name) => `Block Setup — ${name}`,
|
|
81
|
+
needsConfig: 'This block needs to be configured before it can start.',
|
|
82
|
+
configMethod: 'How would you like to configure this block?',
|
|
83
|
+
copyFrom: (name, detail) => `Copy from "${name}" ${detail}`,
|
|
84
|
+
startFresh: 'Start fresh',
|
|
85
|
+
startFreshHint: 'choose provider, model, and skills',
|
|
86
|
+
selectProvider: 'Select your LLM provider:',
|
|
87
|
+
selectModel: 'Select a model:',
|
|
88
|
+
fetchingModels: (provider) => `Fetching ${provider} models...`,
|
|
89
|
+
noModelsFound: 'No models found. Check your API credentials.',
|
|
90
|
+
skillsPlugins: 'Skills & Plugins',
|
|
91
|
+
selectSkills: 'Select Skills & Plugins to enable:',
|
|
92
|
+
configComplete: 'Block configured. Starting...',
|
|
93
|
+
cancelledSetup: 'Setup cancelled.',
|
|
94
|
+
copiedSettings: (source) => `Copied settings from "${source}".`,
|
|
95
|
+
},
|
|
96
|
+
// ─── Init Wizard ────────────────────────────────
|
|
97
|
+
init: {
|
|
98
|
+
welcome: 'memoryblock setup',
|
|
99
|
+
selectProvider: 'Which LLM provider will you use?',
|
|
100
|
+
enterApiKey: (key) => `Enter your ${key}:`,
|
|
101
|
+
verifyingConnection: 'Verifying connection...',
|
|
102
|
+
connectionSuccess: 'Connected successfully.',
|
|
103
|
+
connectionFailed: 'Connection failed. Check your credentials.',
|
|
104
|
+
selectChannel: 'Select communication channels:',
|
|
105
|
+
selectPlugins: 'Select Skills & Plugins to enable:',
|
|
106
|
+
firstBlockName: 'Name your first block:',
|
|
107
|
+
setupComplete: 'Setup complete!',
|
|
108
|
+
},
|
|
109
|
+
// ─── Plugins ─────────────────────────────────────
|
|
110
|
+
plugins: {
|
|
111
|
+
header: 'Skills & Plugins',
|
|
112
|
+
installed: 'Installed',
|
|
113
|
+
available: 'Available',
|
|
114
|
+
added: (name) => `Plugin "${name}" added.`,
|
|
115
|
+
removed: (name) => `Plugin "${name}" removed.`,
|
|
116
|
+
installerNotAvailable: 'Plugin installer not available. Install @memoryblock/plugin-installer.',
|
|
117
|
+
installerNotAvailableShort: 'Plugin installer not available.',
|
|
118
|
+
specifyId: 'Specify a plugin ID: mblk remove <id>',
|
|
119
|
+
installing: (id) => `installing ${id}...`,
|
|
120
|
+
removing: (id) => `removing ${id}...`,
|
|
121
|
+
noConfigurable: 'No plugins with configurable settings.',
|
|
122
|
+
runSettings: 'Run `mblk settings <plugin-id>` to configure.',
|
|
123
|
+
pluginNotFound: (id) => `Plugin "${id}" not found.`,
|
|
124
|
+
noSettings: (name) => `Plugin "${name}" has no configurable settings.`,
|
|
125
|
+
},
|
|
126
|
+
// ─── Permissions ────────────────────────────────
|
|
127
|
+
permissions: {
|
|
128
|
+
scopeBlock: 'block — access only this block\'s directory',
|
|
129
|
+
scopeWorkspace: 'workspace — access the entire workspace',
|
|
130
|
+
scopeSystem: 'system — unrestricted file and shell access',
|
|
131
|
+
invalidScope: (scope) => `Invalid scope: "${scope}". Use: block, workspace, or system.`,
|
|
132
|
+
updated: (name) => `Permissions updated for "${name}".`,
|
|
133
|
+
},
|
|
134
|
+
// ─── Server ─────────────────────────────────────
|
|
135
|
+
server: {
|
|
136
|
+
alreadyRunning: (pid, port) => `Server already running (PID ${pid}${port ? `, port ${port}` : ''}).`,
|
|
137
|
+
startedDaemon: (pid) => `Server started as daemon (PID ${pid}).`,
|
|
138
|
+
daemonStopHint: '`mblk server stop` to shut down.',
|
|
139
|
+
daemonFailed: 'Failed to spawn daemon process.',
|
|
140
|
+
failedToLoad: (msg) => `Failed to load API package: ${msg}`,
|
|
141
|
+
webUiNotFound: 'Web UI package not found. API-only mode.',
|
|
142
|
+
running: 'server running. ctrl+c to stop.',
|
|
143
|
+
serverFailed: (msg) => `Server failed: ${msg}`,
|
|
144
|
+
stoppedPort: (port) => `Server on port ${port} stopped (via port lookup).`,
|
|
145
|
+
noPidFound: 'No server PID found. Server may not be running.',
|
|
146
|
+
stalePid: 'Server process not found (stale PID). Cleaning up.',
|
|
147
|
+
stopped: (pid) => `Server stopped (PID ${pid}).`,
|
|
148
|
+
processGone: 'Server process already gone. Cleaning up.',
|
|
149
|
+
stopFailed: (msg) => `Failed to stop server: ${msg}`,
|
|
150
|
+
statusNotRunning: 'Status: not running',
|
|
151
|
+
statusRunning: 'Status: running',
|
|
152
|
+
statusStalePid: 'Status: not running (stale PID file)',
|
|
153
|
+
url: (port) => `http://localhost:${port}`,
|
|
154
|
+
},
|
|
155
|
+
// ─── Shutdown / Restart ─────────────────────────
|
|
156
|
+
lifecycle: {
|
|
157
|
+
stoppingBlocks: 'Stopping all blocks...',
|
|
158
|
+
stoppingServer: 'Stopping server...',
|
|
159
|
+
everythingStopped: 'Everything shut down.',
|
|
160
|
+
startingServer: 'Starting server...',
|
|
161
|
+
},
|
|
162
|
+
// ─── Channels ───────────────────────────────────
|
|
163
|
+
channels: {
|
|
164
|
+
cli: {
|
|
165
|
+
helpLine1: 'type a message and press enter. ctrl+c to exit.',
|
|
166
|
+
helpLine2: 'commands: /status, /create-block <name>',
|
|
167
|
+
},
|
|
168
|
+
telegram: {
|
|
169
|
+
isOnline: (name) => `${name} is now online.`,
|
|
170
|
+
isOffline: (name) => `${name} is now offline.`,
|
|
171
|
+
anotherInstance: 'Telegram: another instance took over. Disconnecting...',
|
|
172
|
+
anotherRunning: 'Telegram: another instance is running. Disconnecting gracefully...',
|
|
173
|
+
botError: (msg) => `Telegram bot error: ${msg}`,
|
|
174
|
+
pollingStopped: (msg) => `Telegram polling stopped: ${msg}`,
|
|
175
|
+
noToken: 'Telegram bot token not configured. Add it to ~/.memoryblock/ws/auth.json:\n { "telegram": { "botToken": "...", "chatId": "..." } }',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
// ─── Errors ─────────────────────────────────────
|
|
179
|
+
errors: {
|
|
180
|
+
unexpected: (msg) => `Unexpected error: ${msg}`,
|
|
181
|
+
failedToLoad: (what, msg) => `Failed to load ${what}: ${msg}`,
|
|
182
|
+
failedToDelete: (msg) => `Failed to delete: ${msg}`,
|
|
183
|
+
failedToArchive: (msg) => `Failed to archive block: ${msg}`,
|
|
184
|
+
failedToRestore: (msg) => `Failed to restore block: ${msg}`,
|
|
185
|
+
monitorFailed: (msg) => `Monitor failed: ${msg}`,
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=en.js.map
|
package/dist/en.js.map
ADDED
|
@@ -0,0 +1 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EAAE;YACnE,OAAO,EAAE,qIAAqI;SACjJ;KACJ;IAED,mDAAmD;IACnD,MAAM,EAAE;QACJ,UAAU,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,qBAAqB,GAAG,EAAE;QACvD,YAAY,EAAE,CAAC,IAAY,EAAE,GAAW,EAAE,EAAE,CAAC,kBAAkB,IAAI,KAAK,GAAG,EAAE;QAC7E,cAAc,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,qBAAqB,GAAG,EAAE;QAC3D,eAAe,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,4BAA4B,GAAG,EAAE;QACnE,eAAe,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,4BAA4B,GAAG,EAAE;QACnE,aAAa,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,mBAAmB,GAAG,EAAE;KAC3D;CACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale system for memoryblock.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* import { t } from '@memoryblock/locale';
|
|
6
|
+
* log.error(t.general.notInitialized);
|
|
7
|
+
* log.error(t.block.notFound('home'));
|
|
8
|
+
*
|
|
9
|
+
* To add a new language:
|
|
10
|
+
* 1. Copy `en.ts` → `fr.ts` (or any language code)
|
|
11
|
+
* 2. Translate all values, keep function signatures identical
|
|
12
|
+
* 3. Import and register here with registerLocale('fr', fr)
|
|
13
|
+
* 4. Set via config or env: MBLK_LANG=fr
|
|
14
|
+
*/
|
|
15
|
+
import { type Locale } from './en.js';
|
|
16
|
+
/**
|
|
17
|
+
* Set the active locale by language code.
|
|
18
|
+
* Falls back to English if the locale is not found.
|
|
19
|
+
*/
|
|
20
|
+
export declare function setLocale(lang: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Register a new locale.
|
|
23
|
+
* Call this before setLocale() to make a language available.
|
|
24
|
+
*/
|
|
25
|
+
export declare function registerLocale(lang: string, locale: Locale): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get the active locale strings.
|
|
28
|
+
* Use as: t.block.notFound('home')
|
|
29
|
+
*
|
|
30
|
+
* Uses a Proxy so switching locales at runtime works seamlessly.
|
|
31
|
+
*/
|
|
32
|
+
export declare const t: Locale;
|
|
33
|
+
export type { Locale } from './en.js';
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAM,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAK1C;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAEjE;AAED;;;;;GAKG;AACH,eAAO,MAAM,CAAC,EAAE,MAId,CAAC;AAEH,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale system for memoryblock.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* import { t } from '@memoryblock/locale';
|
|
6
|
+
* log.error(t.general.notInitialized);
|
|
7
|
+
* log.error(t.block.notFound('home'));
|
|
8
|
+
*
|
|
9
|
+
* To add a new language:
|
|
10
|
+
* 1. Copy `en.ts` → `fr.ts` (or any language code)
|
|
11
|
+
* 2. Translate all values, keep function signatures identical
|
|
12
|
+
* 3. Import and register here with registerLocale('fr', fr)
|
|
13
|
+
* 4. Set via config or env: MBLK_LANG=fr
|
|
14
|
+
*/
|
|
15
|
+
import { en } from './en.js';
|
|
16
|
+
const locales = { en };
|
|
17
|
+
let active = en;
|
|
18
|
+
/**
|
|
19
|
+
* Set the active locale by language code.
|
|
20
|
+
* Falls back to English if the locale is not found.
|
|
21
|
+
*/
|
|
22
|
+
export function setLocale(lang) {
|
|
23
|
+
active = locales[lang] || en;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Register a new locale.
|
|
27
|
+
* Call this before setLocale() to make a language available.
|
|
28
|
+
*/
|
|
29
|
+
export function registerLocale(lang, locale) {
|
|
30
|
+
locales[lang] = locale;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the active locale strings.
|
|
34
|
+
* Use as: t.block.notFound('home')
|
|
35
|
+
*
|
|
36
|
+
* Uses a Proxy so switching locales at runtime works seamlessly.
|
|
37
|
+
*/
|
|
38
|
+
export const t = new Proxy({}, {
|
|
39
|
+
get(_target, prop) {
|
|
40
|
+
return active[prop];
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,EAAE,EAAe,MAAM,SAAS,CAAC;AAE1C,MAAM,OAAO,GAA2B,EAAE,EAAE,EAAE,CAAC;AAC/C,IAAI,MAAM,GAAW,EAAE,CAAC;AAExB;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IAClC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AACjC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAc;IACvD,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAC3B,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,CAAC,GAAW,IAAI,KAAK,CAAC,EAAY,EAAE;IAC7C,GAAG,CAAC,OAAO,EAAE,IAAI;QACb,OAAQ,MAAc,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;CACJ,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@memoryblock/locale",
|
|
3
|
+
"version": "0.1.0-beta",
|
|
4
|
+
"description": "Locale and i18n strings for memoryblock",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json"
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/en.ts
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* English locale — default language for memoryblock.
|
|
3
|
+
*
|
|
4
|
+
* To add a new language:
|
|
5
|
+
* 1. Copy this file to `<lang>.ts` (e.g., `fr.ts`, `ja.ts`)
|
|
6
|
+
* 2. Translate all string values (keep function signatures identical)
|
|
7
|
+
* 3. Register in `index.ts`
|
|
8
|
+
*
|
|
9
|
+
* Template strings use function params for dynamic values.
|
|
10
|
+
* Keep the exact same param names and types.
|
|
11
|
+
*/
|
|
12
|
+
export const en = {
|
|
13
|
+
|
|
14
|
+
// ─── General ────────────────────────────────────
|
|
15
|
+
general: {
|
|
16
|
+
notInitialized: 'Not initialized. Run `mblk init` first.',
|
|
17
|
+
noBlocksDir: 'No blocks directory found. Create a block with `mblk create <name>`.',
|
|
18
|
+
noBlocksFound: 'No blocks found. Create one with `mblk create <name>`.',
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
// ─── Block Lifecycle ────────────────────────────
|
|
22
|
+
block: {
|
|
23
|
+
notFound: (name: string) => `Block "${name}" not found. Run \`mblk create ${name}\` first.`,
|
|
24
|
+
alreadyExists: (name: string, path: string) => `Block "${name}" already exists at ${path}`,
|
|
25
|
+
alreadyRunning: (name: string) => `Block "${name}" is already running.`,
|
|
26
|
+
singleInstanceHint: 'Each block can only run as one instance at a time.',
|
|
27
|
+
stopHint: (name: string) => `Stop it first with: mblk stop ${name}`,
|
|
28
|
+
staleLockRecovered: 'Recovered from stale lock (previous session crashed).',
|
|
29
|
+
created: (name: string) => `Block "${name}" created.`,
|
|
30
|
+
startWith: (name: string) => `Start with: mblk start ${name}`,
|
|
31
|
+
invalidName: 'Block name must start with a letter/number and contain only lowercase letters, numbers, and hyphens (max 32 chars).',
|
|
32
|
+
createdConfig: 'Created config.json',
|
|
33
|
+
createdPulse: 'Created pulse.json',
|
|
34
|
+
createdMemory: 'Created memory.md',
|
|
35
|
+
createdMonitor: 'Created monitor.md',
|
|
36
|
+
path: (path: string) => `Path: ${path}`,
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// ─── Monitor ────────────────────────────────────
|
|
40
|
+
monitor: {
|
|
41
|
+
shuttingDown: 'Shutting down...',
|
|
42
|
+
goingToSleep: 'Going to sleep.',
|
|
43
|
+
currentSession: 'Current Session',
|
|
44
|
+
completeSession: 'Complete Session',
|
|
45
|
+
online: 'Online. Listening...',
|
|
46
|
+
memoryThreshold: 'Memory threshold. Smart-saving context...',
|
|
47
|
+
error: (msg: string) => `Monitor error: ${msg}`,
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
// ─── Status ─────────────────────────────────────
|
|
51
|
+
status: {
|
|
52
|
+
noActive: 'No active blocks.',
|
|
53
|
+
archived: (count: number) => `📦 ${count} archived`,
|
|
54
|
+
restoreHint: 'Restore with: mblk restore <name>',
|
|
55
|
+
invalidConfig: 'invalid config',
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// ─── Stop ───────────────────────────────────────
|
|
59
|
+
stop: {
|
|
60
|
+
noBlocksDir: 'No blocks directory found. Nothing to stop.',
|
|
61
|
+
noActive: 'No active blocks to stop.',
|
|
62
|
+
notFound: (name: string) => `Block "${name}" not found.`,
|
|
63
|
+
alreadySleeping: (name: string) => `${name}: already sleeping`,
|
|
64
|
+
stoppedDaemon: (name: string) => `${name}: stopped (daemon process killed)`,
|
|
65
|
+
stopped: (name: string) => `${name}: stopped`,
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
// ─── Delete / Archive / Restore ─────────────────
|
|
69
|
+
archive: {
|
|
70
|
+
success: (name: string) => `Block "${name}" archived safely.`,
|
|
71
|
+
location: (path: string) => `Location: ${path}`,
|
|
72
|
+
restoreCmd: (name: string) => `To restore: mblk restore ${name}`,
|
|
73
|
+
deleteCmd: (name: string) => `To permanently delete: mblk delete ${name} --hard`,
|
|
74
|
+
hardDeleteSuccess: (name: string) => `"${name}" permanently deleted.`,
|
|
75
|
+
hardDeleteArchiveSuccess: (name: string) => `"${name}" permanently deleted from archive.`,
|
|
76
|
+
mustUseHard: 'Archived blocks must be deleted permanently using the --hard flag.',
|
|
77
|
+
notFoundBlock: (name: string) => `Block "${name}" not found. Run \`mblk status\` to see available blocks.`,
|
|
78
|
+
notFoundArchive: (name: string) => `No archive found for "${name}". Run \`mblk status\` to check archives.`,
|
|
79
|
+
notFoundEither: (name: string) => `Block or archive "${name}" not found.`,
|
|
80
|
+
multipleFound: (name: string) => `Multiple archives found for "${name}". Which one?`,
|
|
81
|
+
restoreSuccess: (name: string) => `Block "${name}" restored successfully.`,
|
|
82
|
+
restoreConflict: (name: string) => `Cannot restore: A block named "${name}" already exists. Delete or rename it first.`,
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
// ─── Onboarding / Setup ─────────────────────────
|
|
86
|
+
setup: {
|
|
87
|
+
title: (name: string) => `Block Setup — ${name}`,
|
|
88
|
+
needsConfig: 'This block needs to be configured before it can start.',
|
|
89
|
+
configMethod: 'How would you like to configure this block?',
|
|
90
|
+
copyFrom: (name: string, detail: string) => `Copy from "${name}" ${detail}`,
|
|
91
|
+
startFresh: 'Start fresh',
|
|
92
|
+
startFreshHint: 'choose provider, model, and skills',
|
|
93
|
+
selectProvider: 'Select your LLM provider:',
|
|
94
|
+
selectModel: 'Select a model:',
|
|
95
|
+
fetchingModels: (provider: string) => `Fetching ${provider} models...`,
|
|
96
|
+
noModelsFound: 'No models found. Check your API credentials.',
|
|
97
|
+
skillsPlugins: 'Skills & Plugins',
|
|
98
|
+
selectSkills: 'Select Skills & Plugins to enable:',
|
|
99
|
+
configComplete: 'Block configured. Starting...',
|
|
100
|
+
cancelledSetup: 'Setup cancelled.',
|
|
101
|
+
copiedSettings: (source: string) => `Copied settings from "${source}".`,
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
// ─── Init Wizard ────────────────────────────────
|
|
105
|
+
init: {
|
|
106
|
+
welcome: 'memoryblock setup',
|
|
107
|
+
selectProvider: 'Which LLM provider will you use?',
|
|
108
|
+
enterApiKey: (key: string) => `Enter your ${key}:`,
|
|
109
|
+
verifyingConnection: 'Verifying connection...',
|
|
110
|
+
connectionSuccess: 'Connected successfully.',
|
|
111
|
+
connectionFailed: 'Connection failed. Check your credentials.',
|
|
112
|
+
selectChannel: 'Select communication channels:',
|
|
113
|
+
selectPlugins: 'Select Skills & Plugins to enable:',
|
|
114
|
+
firstBlockName: 'Name your first block:',
|
|
115
|
+
setupComplete: 'Setup complete!',
|
|
116
|
+
},
|
|
117
|
+
|
|
118
|
+
// ─── Plugins ─────────────────────────────────────
|
|
119
|
+
plugins: {
|
|
120
|
+
header: 'Skills & Plugins',
|
|
121
|
+
installed: 'Installed',
|
|
122
|
+
available: 'Available',
|
|
123
|
+
added: (name: string) => `Plugin "${name}" added.`,
|
|
124
|
+
removed: (name: string) => `Plugin "${name}" removed.`,
|
|
125
|
+
installerNotAvailable: 'Plugin installer not available. Install @memoryblock/plugin-installer.',
|
|
126
|
+
installerNotAvailableShort: 'Plugin installer not available.',
|
|
127
|
+
specifyId: 'Specify a plugin ID: mblk remove <id>',
|
|
128
|
+
installing: (id: string) => `installing ${id}...`,
|
|
129
|
+
removing: (id: string) => `removing ${id}...`,
|
|
130
|
+
noConfigurable: 'No plugins with configurable settings.',
|
|
131
|
+
runSettings: 'Run `mblk settings <plugin-id>` to configure.',
|
|
132
|
+
pluginNotFound: (id: string) => `Plugin "${id}" not found.`,
|
|
133
|
+
noSettings: (name: string) => `Plugin "${name}" has no configurable settings.`,
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
// ─── Permissions ────────────────────────────────
|
|
137
|
+
permissions: {
|
|
138
|
+
scopeBlock: 'block — access only this block\'s directory',
|
|
139
|
+
scopeWorkspace: 'workspace — access the entire workspace',
|
|
140
|
+
scopeSystem: 'system — unrestricted file and shell access',
|
|
141
|
+
invalidScope: (scope: string) => `Invalid scope: "${scope}". Use: block, workspace, or system.`,
|
|
142
|
+
updated: (name: string) => `Permissions updated for "${name}".`,
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
// ─── Server ─────────────────────────────────────
|
|
146
|
+
server: {
|
|
147
|
+
alreadyRunning: (pid: number, port?: string) => `Server already running (PID ${pid}${port ? `, port ${port}` : ''}).`,
|
|
148
|
+
startedDaemon: (pid: number) => `Server started as daemon (PID ${pid}).`,
|
|
149
|
+
daemonStopHint: '`mblk server stop` to shut down.',
|
|
150
|
+
daemonFailed: 'Failed to spawn daemon process.',
|
|
151
|
+
failedToLoad: (msg: string) => `Failed to load API package: ${msg}`,
|
|
152
|
+
webUiNotFound: 'Web UI package not found. API-only mode.',
|
|
153
|
+
running: 'server running. ctrl+c to stop.',
|
|
154
|
+
serverFailed: (msg: string) => `Server failed: ${msg}`,
|
|
155
|
+
stoppedPort: (port: string | number) => `Server on port ${port} stopped (via port lookup).`,
|
|
156
|
+
noPidFound: 'No server PID found. Server may not be running.',
|
|
157
|
+
stalePid: 'Server process not found (stale PID). Cleaning up.',
|
|
158
|
+
stopped: (pid: number) => `Server stopped (PID ${pid}).`,
|
|
159
|
+
processGone: 'Server process already gone. Cleaning up.',
|
|
160
|
+
stopFailed: (msg: string) => `Failed to stop server: ${msg}`,
|
|
161
|
+
statusNotRunning: 'Status: not running',
|
|
162
|
+
statusRunning: 'Status: running',
|
|
163
|
+
statusStalePid: 'Status: not running (stale PID file)',
|
|
164
|
+
url: (port: string | number) => `http://localhost:${port}`,
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
// ─── Shutdown / Restart ─────────────────────────
|
|
168
|
+
lifecycle: {
|
|
169
|
+
stoppingBlocks: 'Stopping all blocks...',
|
|
170
|
+
stoppingServer: 'Stopping server...',
|
|
171
|
+
everythingStopped: 'Everything shut down.',
|
|
172
|
+
startingServer: 'Starting server...',
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
// ─── Channels ───────────────────────────────────
|
|
176
|
+
channels: {
|
|
177
|
+
cli: {
|
|
178
|
+
helpLine1: 'type a message and press enter. ctrl+c to exit.',
|
|
179
|
+
helpLine2: 'commands: /status, /create-block <name>',
|
|
180
|
+
},
|
|
181
|
+
telegram: {
|
|
182
|
+
isOnline: (name: string) => `${name} is now online.`,
|
|
183
|
+
isOffline: (name: string) => `${name} is now offline.`,
|
|
184
|
+
anotherInstance: 'Telegram: another instance took over. Disconnecting...',
|
|
185
|
+
anotherRunning: 'Telegram: another instance is running. Disconnecting gracefully...',
|
|
186
|
+
botError: (msg: string) => `Telegram bot error: ${msg}`,
|
|
187
|
+
pollingStopped: (msg: string) => `Telegram polling stopped: ${msg}`,
|
|
188
|
+
noToken: 'Telegram bot token not configured. Add it to ~/.memoryblock/ws/auth.json:\n { "telegram": { "botToken": "...", "chatId": "..." } }',
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
// ─── Errors ─────────────────────────────────────
|
|
193
|
+
errors: {
|
|
194
|
+
unexpected: (msg: string) => `Unexpected error: ${msg}`,
|
|
195
|
+
failedToLoad: (what: string, msg: string) => `Failed to load ${what}: ${msg}`,
|
|
196
|
+
failedToDelete: (msg: string) => `Failed to delete: ${msg}`,
|
|
197
|
+
failedToArchive: (msg: string) => `Failed to archive block: ${msg}`,
|
|
198
|
+
failedToRestore: (msg: string) => `Failed to restore block: ${msg}`,
|
|
199
|
+
monitorFailed: (msg: string) => `Monitor failed: ${msg}`,
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export type Locale = typeof en;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale system for memoryblock.
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* import { t } from '@memoryblock/locale';
|
|
6
|
+
* log.error(t.general.notInitialized);
|
|
7
|
+
* log.error(t.block.notFound('home'));
|
|
8
|
+
*
|
|
9
|
+
* To add a new language:
|
|
10
|
+
* 1. Copy `en.ts` → `fr.ts` (or any language code)
|
|
11
|
+
* 2. Translate all values, keep function signatures identical
|
|
12
|
+
* 3. Import and register here with registerLocale('fr', fr)
|
|
13
|
+
* 4. Set via config or env: MBLK_LANG=fr
|
|
14
|
+
*/
|
|
15
|
+
import { en, type Locale } from './en.js';
|
|
16
|
+
|
|
17
|
+
const locales: Record<string, Locale> = { en };
|
|
18
|
+
let active: Locale = en;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Set the active locale by language code.
|
|
22
|
+
* Falls back to English if the locale is not found.
|
|
23
|
+
*/
|
|
24
|
+
export function setLocale(lang: string): void {
|
|
25
|
+
active = locales[lang] || en;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Register a new locale.
|
|
30
|
+
* Call this before setLocale() to make a language available.
|
|
31
|
+
*/
|
|
32
|
+
export function registerLocale(lang: string, locale: Locale): void {
|
|
33
|
+
locales[lang] = locale;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Get the active locale strings.
|
|
38
|
+
* Use as: t.block.notFound('home')
|
|
39
|
+
*
|
|
40
|
+
* Uses a Proxy so switching locales at runtime works seamlessly.
|
|
41
|
+
*/
|
|
42
|
+
export const t: Locale = new Proxy({} as Locale, {
|
|
43
|
+
get(_target, prop) {
|
|
44
|
+
return (active as any)[prop];
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export type { Locale } from './en.js';
|