@memoryblock/locale 0.1.0-beta → 0.1.1-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/README.md +35 -0
- package/package.json +40 -5
- package/src/en.ts +0 -203
- package/src/index.ts +0 -48
- package/tsconfig.json +0 -10
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @memoryblock/locale
|
|
2
|
+
|
|
3
|
+
Localization strings and formatting utilities for **memoryblock**.
|
|
4
|
+
|
|
5
|
+
This package handles:
|
|
6
|
+
- i18n support across the CLI and backend
|
|
7
|
+
- Language bundles processing
|
|
8
|
+
- Dynamic message formatting
|
|
9
|
+
|
|
10
|
+
## The `memoryblock` Ecosystem
|
|
11
|
+
|
|
12
|
+
**memoryblock** is a highly modular system. Here are the official packages:
|
|
13
|
+
|
|
14
|
+
**The Core**
|
|
15
|
+
* [**memoryblock**](https://www.npmjs.com/package/memoryblock) - The core engine interface and types.
|
|
16
|
+
* [**@memoryblock/daemon**](https://www.npmjs.com/package/@memoryblock/daemon) - Background daemon manager.
|
|
17
|
+
* [**@memoryblock/api**](https://www.npmjs.com/package/@memoryblock/api) - Core REST and WebSocket API server.
|
|
18
|
+
|
|
19
|
+
**Integrations & Tooling**
|
|
20
|
+
* [**@memoryblock/adapters**](https://www.npmjs.com/package/@memoryblock/adapters) - LLM adapters (OpenAI, Anthropic, Bedrock, etc).
|
|
21
|
+
* [**@memoryblock/channels**](https://www.npmjs.com/package/@memoryblock/channels) - Communication channels (CLI, Telegram, Web).
|
|
22
|
+
* [**@memoryblock/tools**](https://www.npmjs.com/package/@memoryblock/tools) - Standard tool definitions and schemas.
|
|
23
|
+
* [**@memoryblock/locale**](https://www.npmjs.com/package/@memoryblock/locale) - Localization strings and formatting.
|
|
24
|
+
* [**@memoryblock/web**](https://www.npmjs.com/package/@memoryblock/web) - Front-end dashboard and Web UI.
|
|
25
|
+
|
|
26
|
+
**Plugins**
|
|
27
|
+
* [**@memoryblock/plugin-installer**](https://www.npmjs.com/package/@memoryblock/plugin-installer) - Plugin installer and registry manager.
|
|
28
|
+
* [**@memoryblock/plugin-agents**](https://www.npmjs.com/package/@memoryblock/plugin-agents) - Secondary AI agents orchestrator.
|
|
29
|
+
* [**@memoryblock/plugin-aws**](https://www.npmjs.com/package/@memoryblock/plugin-aws) - AWS integrations.
|
|
30
|
+
* [**@memoryblock/plugin-fetch-webpage**](https://www.npmjs.com/package/@memoryblock/plugin-fetch-webpage) - Web content fetching and parsing.
|
|
31
|
+
* [**@memoryblock/plugin-web-search**](https://www.npmjs.com/package/@memoryblock/plugin-web-search) - Web search capabilities.
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
Distributed under the MIT License. See `LICENSE` for more information.
|
package/package.json
CHANGED
|
@@ -1,17 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memoryblock/locale",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Locale and i18n strings for memoryblock",
|
|
3
|
+
"version": "0.1.1-beta",
|
|
5
4
|
"type": "module",
|
|
5
|
+
"description": "Localization strings and formatting utilities for memoryblock.",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist/"
|
|
8
|
+
],
|
|
6
9
|
"main": "dist/index.js",
|
|
7
10
|
"types": "dist/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc -p tsconfig.json"
|
|
13
|
+
},
|
|
8
14
|
"exports": {
|
|
9
15
|
".": {
|
|
10
16
|
"types": "./dist/index.d.ts",
|
|
11
17
|
"import": "./dist/index.js"
|
|
12
18
|
}
|
|
13
19
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
20
|
+
"keywords": [
|
|
21
|
+
"memoryblock",
|
|
22
|
+
"mblk",
|
|
23
|
+
"ai-agent",
|
|
24
|
+
"assistants",
|
|
25
|
+
"agents",
|
|
26
|
+
"automation",
|
|
27
|
+
"multi-agent",
|
|
28
|
+
"agentic-framework",
|
|
29
|
+
"locale",
|
|
30
|
+
"i18n",
|
|
31
|
+
"translations",
|
|
32
|
+
"language",
|
|
33
|
+
"localization",
|
|
34
|
+
"internationalization",
|
|
35
|
+
"l10n",
|
|
36
|
+
"i18next"
|
|
37
|
+
],
|
|
38
|
+
"author": {
|
|
39
|
+
"name": "Ghazi",
|
|
40
|
+
"url": "https://mgks.dev"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/memoryblock-io/memoryblock.git"
|
|
45
|
+
},
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/memoryblock-io/memoryblock/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://memoryblock.io",
|
|
50
|
+
"funding": "https://github.com/sponsors/mgks",
|
|
51
|
+
"license": "MIT"
|
|
17
52
|
}
|
package/src/en.ts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
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';
|