š AI-powered multilingual documentation with Lingo integration
npm install devdocs-globalbash
npm install -g devdocs-global
`
#### Local Project
`bash
npm install devdocs-global
`
$3
#### 1. Get API Key
1. Visit lingo.dev
2. Sign up for free
3. Get your API key from dashboard
#### 2. Initialize
`bash
devdocs-global init
`
Creates devdocs.config.json with default settings.
#### 3. Set API Key
`bash
export LINGODOTDEV_API_KEY=your_api_key_here
`
Or add to .env.local:
`
LINGODOTDEV_API_KEY=your_api_key_here
`
#### 4. Organize Your Docs
`
docs/
āāā en/
āāā getting-started.md
āāā installation.md
āāā features.md
`
#### 5. Translate
`bash
devdocs-global translate
`
Creates:
`
docs/
āāā en/ (original)
āāā es/ (Spanish)
āāā fr/ (French)
āāā de/ (German)
āāā ja/ (Japanese)
āāā hi/ (Hindi)
āāā zh/ (Chinese)
`
š Commands
$3
Initialize DevDocs Global in your project.
`bash
devdocs-global init
`
Creates devdocs.config.json:
`json
{
"sourceLanguage": "en",
"sourceDir": "./docs",
"targetLanguages": ["es", "fr", "de", "ja", "hi", "zh"],
"outputDir": "./docs",
"apiKey": "your-api-key",
"cacheDir": "./.lingo-cache"
}
`
$3
Translate documentation to multiple languages.
`bash
devdocs-global translate
`
Options:
`bash
-s, --source Source language (default: auto-detect)
-t, --targets Target languages (comma-separated)
--source-dir Source documentation directory
--output-dir Output directory for translations
--incremental Only translate changed files
`
Examples:
`bash
Translate all files to default languages
devdocs-global translate
Translate to specific languages only
devdocs-global translate -t es,fr,de
Use custom directories
devdocs-global translate --source-dir ./documentation --output-dir ./translated
Only translate changed files (faster)
devdocs-global translate --incremental
Specify source language
devdocs-global translate -s en -t es,fr
`
$3
Detect the language of a document.
`bash
devdocs-global detect docs/en/getting-started.md
`
Output:
`
Detected language: en
`
$3
Show translation status and statistics.
`bash
devdocs-global status
`
Output:
`
š Translation Status
Configuration:
Source Language: en
Target Languages: es, fr, de, ja, hi, zh
Source Dir: ./docs
Output Dir: ./docs
Cache Status: 5 files cached
`
š Configuration
Edit devdocs.config.json:
`json
{
"sourceLanguage": "en",
"sourceDir": "./docs",
"targetLanguages": ["es", "fr", "de", "ja", "hi", "zh"],
"outputDir": "./docs",
"apiKey": "your-lingo-api-key",
"cacheDir": "./.lingo-cache"
}
`
$3
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| sourceLanguage | string | "en" | Source language code (or "auto" to detect) |
| sourceDir | string | "./docs" | Directory containing source documentation |
| targetLanguages | array | ["es", "fr", "de", "ja", "hi", "zh"] | Target language codes |
| outputDir | string | "./docs" | Output directory for translations |
| apiKey | string | - | Lingo.dev API key |
| cacheDir | string | "./.lingo-cache" | Cache directory for incremental updates |
š Supported Languages
| Code | Language |
|------|----------|
| en | English |
| es | Spanish |
| fr | French |
| de | German |
| ja | Japanese |
| hi | Hindi |
| zh | Chinese |
| pt | Portuguese |
| ru | Russian |
| ar | Arabic |
š GitHub Actions Integration
Automatically translate documentation on every push!
$3
1. Add Secret
- Go to: Settings ā Secrets and variables ā Actions
- Add: LINGODOTDEV_API_KEY with your API key
2. Create Workflow
File: .github/workflows/auto-translate.yml
`yaml
name: Auto-Translate Documentation
on:
push:
branches: [ main ]
paths:
- 'docs/en/**'
- 'package.json'
- '.github/workflows/auto-translate.yml'
permissions:
contents: write
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- name: Clean old translations
run: rm -rf docs/es docs/fr docs/de docs/ja docs/hi docs/zh
- name: Run translations
env:
LINGODOTDEV_API_KEY: \${{ secrets.LINGODOTDEV_API_KEY }}
run: npm run translate
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if ! git diff --quiet; then
git add docs/
git commit -m "š chore: Auto-translate documentation"
git push origin main
fi
`
š» Web Dashboard
Use the web interface for easier management:
1. Start Dev Server
`bash
npm run dev
`
2. Open Dashboard
`
http://localhost:3000/dashboard
`
3. Upload & Translate
- Select markdown files
- Choose target languages
- Click "Translate Now"
- Download results
š ļø Development
$3
- Node.js 18+
- npm or yarn
- Git
$3
`bash
Clone repository
git clone https://github.com/Patelmedhansh/DevDocs-Global.git
cd DevDocs-Global
Install dependencies
npm install
Create .env.local
echo "LINGODOTDEV_API_KEY=your_key_here" > .env.local
Start development
npm run dev
`
$3
`
DevDocs-Global/
āāā src/
ā āāā cli/ # CLI tool
ā ā āāā index.js # Main CLI entry
ā ā āāā translator.js # Lingo SDK integration
ā ā āāā extractor.js # Text extraction
ā ā āāā cache.js # Caching logic
ā ā āāā languageDetector.js
ā āāā app/ # Next.js web app
ā āāā page.js # Home page
ā āāā dashboard/ # Dashboard
ā āāā api/ # API routes
āāā docs/
ā āāā en/ # Source documentation
āāā .github/workflows/ # GitHub Actions
āāā package.json
āāā README.md
`
š¦ API Reference
$3
`javascript
import { LingoTranslator } from './translator.js';
const translator = new LingoTranslator(apiKey);
// Translate text
const result = await translator.translate(text, 'en', 'es');
// Batch translate
const results = await translator.batchTranslate(texts, 'en', ['es', 'fr']);
// Detect language
const lang = await translator.detectLanguage(text);
// Get supported languages
const langs = await translator.getSupportedLanguages();
`
š Security
- ā
API keys stored locally in .env.local (not committed)
- ā
Never exposed in public files
- ā
GitHub Actions uses Secrets (encrypted)
- ā
No data sent to third parties except Lingo.dev
- ā
Uses HTTPS for all API calls
š Performance
- Translation Speed: ~2-5 seconds per file
- Caching: 50-70% faster on incremental updates
- Memory Usage: <100MB typical
- API Efficiency: Smart batching reduces API calls
š° Cost Estimation
Based on Lingo.dev pricing:
- Free Tier: ~10,000 words/month
- Small Project (100KB docs): ~\$5-10/month
- Medium Project (1MB docs): ~\$50-100/month
- Large Project (10MB docs): ~\$500-1000/month
š Troubleshooting
$3
`bash
Check .env.local exists
cat .env.local
Should show:
LINGODOTDEV_API_KEY=your_key
If missing, create it:
echo "LINGODOTDEV_API_KEY=your_key" > .env.local
`
$3
`bash
Verify source directory structure
find docs/en -name "*.md"
Should show your markdown files
`
$3
`bash
1. Verify API key is correct
npm run status
2. Get new key from lingo.dev if expired
3. Update .env.local
4. Restart: npm run dev
5. Try again: npm run translate
`
$3
1. Go to: Settings ā Actions ā General
2. Select: "Read and write permissions"
3. Check: "Allow GitHub Actions to create pull requests"
4. Save and retry
š¤ Contributing
Contributions welcome! Please:
1. Fork the repository
2. Create feature branch (git checkout -b feature/amazing-feature)
3. Commit changes (git commit -m 'Add amazing feature')
4. Push to branch (git push origin feature/amazing-feature`)