String Forge Translation Extension
Create StringForge literals directly from selected text in Visual Studio Code.
Features
- Right click on selected text and run "Send Selection to StringForge".
- Reads project credentials from
stringforge.json in the workspace root.
- Sends a POST request to
/api/export/{projectId}/literals.
- Replaces selected text with either:
key
t("key")
translate("key")
custom("key") (configurable function name)
Requirements
- A
stringforge.json file in workspace root with:
{
"projectId": "your-project-id",
"apiKey": "your-export-api-key",
"outputDir": "./src/components/translation",
"baseUrl": "http://localhost:3000"
}
Notas:
projectId debe ser el ID interno del proyecto (no el slug).
apiKey debe ser la Export API Key del proyecto.
- También se aceptan los alias
exportApiKey y apiBaseUrl en stringforge.json.
baseUrl is optional. If missing, the extension uses http://localhost:3000 by default.
Extension Settings
string-forge-translation-extension.replacementMode
key (default)
t
translate
custom
string-forge-translation-extension.customReplacementFunction
- Function name/path used when mode is
custom.
- Default:
custom.
- Examples:
custom, i18n.t, translator.wrap.
string-forge-translation-extension.apiBaseUrl
- Optional base URL override for API requests.
- If empty, falls back to
stringforge.json.baseUrl and then http://localhost:3000.
Usage
- Select text in the editor.
- Right click and choose "Send Selection to StringForge".
- Enter:
type (e.g. label, title, error)
primaryKey (e.g. app.team.page)
- The extension creates/reuses a literal and replaces the selection.
Release Notes
0.0.1
- Initial MVP with context menu command and StringForge API integration.
| |