Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
name: Release

on:
workflow_dispatch:
workflow_run:
workflows: ["CI"]
push:
branches: [main]
types:
- completed

permissions:
contents: read # for checkout

jobs:
release:
name: Release
# Only run if the CI workflow was successful
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
Expand Down
80 changes: 80 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,81 @@
# @tanstack-dev/translate-docs

A utility for translating TanStack documentation into multiple languages.

## Configuration

Create a `translate.config.mjs` file in your project root with the following structure:

```js
// Single configuration
export default {
langs: {
// Language configurations
// Example: 'zh', 'es', 'fr', etc.
[languageCode]: {
name: String, // Language name
guide: String, // Translation guidelines
terms: { // Dictionary of common terms
// 'term': 'translation'
},
},
},
docsRoot: String | String[], // Root directory or array of root directories
docsContext: String, // Context information for the translator
}

// OR multiple configurations as an array
export default [
{
langs: { /* ... */ },
docsRoot: String | String[],
docsContext: String,
},
{
langs: { /* ... */ },
docsRoot: String | String[],
docsContext: String,
}
]
```

## Usage

Run the translation tool with:

```bash
OPENAI_API_KEY=your-openai-api-key npx translate-docs
```

### Command Line Options

The tool supports the following command line options:

```
Options:
-c, --config <path> Path to configuration file
-v, --verbose Enable verbose logging
-p, --pattern <pattern> File pattern to match for updating (e.g., "*.md" or "docs/**/*.tsx")
-l, --list-only Only list file status without updating docs
-u, --update-config-only Only update config without processing docs
-h, --help Display help for command
```

Examples:

```bash
# Use a specific configuration file
npx translate-docs --config ./custom-config.mjs

# Only process markdown files
npx translate-docs --pattern "**/*.md"

# Just check which files would be processed without making changes
npx translate-docs --list-only

# Update translation configuration without processing docs
npx translate-docs --update-config-only

# Enable verbose logging for troubleshooting
npx translate-docs --verbose
```
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
"license": "ISC",
"devDependencies": {
"@biomejs/biome": "1.5.3",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@types/commander": "^2.12.5",
"@types/node": "^22.14.0",
"semantic-release": "^21.0.0",
Expand Down
Loading