mirror of
https://github.com/nocobase/nocobase.git
synced 2026-08-29 02:03:53 +08:00
docs: git submodule readme
This commit is contained in:
+136
@@ -1 +1,137 @@
|
||||
# NocoBase Documentation
|
||||
|
||||
This repository contains the official NocoBase documentation with multilingual support.
|
||||
|
||||
## Architecture
|
||||
|
||||
The documentation uses a **git submodule** approach for multilingual content:
|
||||
|
||||
- **Main repository**: Contains English (`en`) and Chinese (`cn`) documentation
|
||||
- **Language submodules**: Each additional language is maintained in a separate repository
|
||||
|
||||
```
|
||||
docs/
|
||||
├── docs/
|
||||
│ ├── en/ # English (in main repo)
|
||||
│ ├── cn/ # Chinese (in main repo)
|
||||
│ ├── ja/ → submodule # Japanese
|
||||
│ ├── ko/ → submodule # Korean
|
||||
│ ├── de/ → submodule # German
|
||||
│ └── ... # Other languages
|
||||
├── theme/
|
||||
├── rspress.config.ts
|
||||
└── package.json
|
||||
```
|
||||
|
||||
## Language Repositories
|
||||
|
||||
| Language | Repository |
|
||||
|----------|------------|
|
||||
| Japanese (ja) | [Albert-mah/nocobase-docs-ja](https://github.com/Albert-mah/nocobase-docs-ja) |
|
||||
| Korean (ko) | [Albert-mah/nocobase-docs-ko](https://github.com/Albert-mah/nocobase-docs-ko) |
|
||||
| German (de) | [Albert-mah/nocobase-docs-de](https://github.com/Albert-mah/nocobase-docs-de) |
|
||||
| French (fr) | [Albert-mah/nocobase-docs-fr](https://github.com/Albert-mah/nocobase-docs-fr) |
|
||||
| Spanish (es) | [Albert-mah/nocobase-docs-es](https://github.com/Albert-mah/nocobase-docs-es) |
|
||||
| Portuguese (pt) | [Albert-mah/nocobase-docs-pt](https://github.com/Albert-mah/nocobase-docs-pt) |
|
||||
| Russian (ru) | [Albert-mah/nocobase-docs-ru](https://github.com/Albert-mah/nocobase-docs-ru) |
|
||||
| Italian (it) | [Albert-mah/nocobase-docs-it](https://github.com/Albert-mah/nocobase-docs-it) |
|
||||
| Turkish (tr) | [Albert-mah/nocobase-docs-tr](https://github.com/Albert-mah/nocobase-docs-tr) |
|
||||
| Ukrainian (uk) | [Albert-mah/nocobase-docs-uk](https://github.com/Albert-mah/nocobase-docs-uk) |
|
||||
| Vietnamese (vi) | [Albert-mah/nocobase-docs-vi](https://github.com/Albert-mah/nocobase-docs-vi) |
|
||||
| Indonesian (id) | [Albert-mah/nocobase-docs-id](https://github.com/Albert-mah/nocobase-docs-id) |
|
||||
| Thai (th) | [Albert-mah/nocobase-docs-th](https://github.com/Albert-mah/nocobase-docs-th) |
|
||||
| Polish (pl) | [Albert-mah/nocobase-docs-pl](https://github.com/Albert-mah/nocobase-docs-pl) |
|
||||
| Dutch (nl) | [Albert-mah/nocobase-docs-nl](https://github.com/Albert-mah/nocobase-docs-nl) |
|
||||
| Czech (cs) | [Albert-mah/nocobase-docs-cs](https://github.com/Albert-mah/nocobase-docs-cs) |
|
||||
| Arabic (ar) | [Albert-mah/nocobase-docs-ar](https://github.com/Albert-mah/nocobase-docs-ar) |
|
||||
| Hebrew (he) | [Albert-mah/nocobase-docs-he](https://github.com/Albert-mah/nocobase-docs-he) |
|
||||
| Hindi (hi) | [Albert-mah/nocobase-docs-hi](https://github.com/Albert-mah/nocobase-docs-hi) |
|
||||
| Swedish (sv) | [Albert-mah/nocobase-docs-sv](https://github.com/Albert-mah/nocobase-docs-sv) |
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Clone with English and Chinese only (fastest)
|
||||
|
||||
```bash
|
||||
git clone https://github.com/nocobase/nocobase.git
|
||||
cd nocobase/docs
|
||||
yarn install
|
||||
yarn dev
|
||||
```
|
||||
|
||||
### Load specific languages on demand
|
||||
|
||||
```bash
|
||||
# Load Japanese and Korean
|
||||
git submodule update --init docs/docs/ja docs/docs/ko
|
||||
|
||||
# Start dev server (will include en, cn, ja, ko)
|
||||
yarn dev
|
||||
```
|
||||
|
||||
### Load all languages
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
yarn dev
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js 18+
|
||||
- Yarn
|
||||
|
||||
### Commands
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
yarn install
|
||||
|
||||
# Start development server
|
||||
yarn dev
|
||||
|
||||
# Build for production
|
||||
yarn build
|
||||
|
||||
# Preview production build
|
||||
yarn preview
|
||||
```
|
||||
|
||||
### Dynamic Locale Detection
|
||||
|
||||
The `rspress.config.ts` automatically detects available languages by checking which directories have content. Languages from uninitialized submodules are automatically excluded from the build.
|
||||
|
||||
```typescript
|
||||
// Only languages with content will be included
|
||||
[rspress] Available locales: en, cn, ja, ko
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
### Contributing to English/Chinese docs
|
||||
|
||||
1. Fork the main repository
|
||||
2. Make your changes in `docs/en/` or `docs/cn/`
|
||||
3. Submit a Pull Request
|
||||
|
||||
### Contributing to other languages
|
||||
|
||||
1. Fork the corresponding language repository (e.g., `nocobase-docs-ja`)
|
||||
2. Make your changes
|
||||
3. Submit a Pull Request to the language repository
|
||||
|
||||
### Adding a new language
|
||||
|
||||
1. Create a new repository for the language (e.g., `nocobase-docs-xx`)
|
||||
2. Use the existing language repos as a template
|
||||
3. Add the submodule to the main repository:
|
||||
```bash
|
||||
git submodule add https://github.com/YOUR_ORG/nocobase-docs-xx docs/docs/xx
|
||||
```
|
||||
4. Add the locale configuration to `rspress.config.ts`
|
||||
|
||||
## License
|
||||
|
||||
Same as the main NocoBase repository.
|
||||
|
||||
Executable
+136
@@ -0,0 +1,136 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Languages to process (excluding en, cn, vi which are already done)
|
||||
LANGS="ar cs de es fr he hi id it ja ko nl pl pt ru sv th tr uk"
|
||||
|
||||
MAIN_REPO="/home/albert/prj/nocobase"
|
||||
DOCS_DIR="$MAIN_REPO/docs/docs"
|
||||
|
||||
for lang in $LANGS; do
|
||||
echo "======================================"
|
||||
echo "Processing: $lang"
|
||||
echo "======================================"
|
||||
|
||||
REPO_NAME="nocobase-docs-$lang"
|
||||
REPO_DIR="/home/albert/prj/$REPO_NAME"
|
||||
|
||||
# 1. Create local repo directory
|
||||
if [ -d "$REPO_DIR" ]; then
|
||||
echo "Directory exists, cleaning..."
|
||||
rm -rf "$REPO_DIR"
|
||||
fi
|
||||
mkdir -p "$REPO_DIR"
|
||||
|
||||
# 2. Copy docs content (flat structure for submodule)
|
||||
echo "Copying docs content..."
|
||||
cp -r "$DOCS_DIR/$lang"/* "$REPO_DIR/"
|
||||
|
||||
# 3. Copy logos
|
||||
cp "$DOCS_DIR/public/logo.png" "$REPO_DIR/" 2>/dev/null
|
||||
cp "$DOCS_DIR/public/logo-white.png" "$REPO_DIR/" 2>/dev/null
|
||||
|
||||
# 4. Create package.json
|
||||
cat > "$REPO_DIR/package.json" << EOF
|
||||
{
|
||||
"name": "@nocobase/docs-$lang",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "rspress build",
|
||||
"dev": "rspress dev",
|
||||
"preview": "rspress preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@rspress/core": "^2.0.0-beta.34"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rsbuild/plugin-sass": "^1.4.0",
|
||||
"@rspress/plugin-sitemap": "^2.0.0-beta.34"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# 5. Create rspress.config.ts
|
||||
cat > "$REPO_DIR/rspress.config.ts" << EOF
|
||||
import { pluginSass } from '@rsbuild/plugin-sass';
|
||||
import { defineConfig } from '@rspress/core';
|
||||
import { pluginSitemap } from '@rspress/plugin-sitemap';
|
||||
|
||||
const base = process.env.DOCS_BASE || '/$lang/';
|
||||
|
||||
export default defineConfig({
|
||||
root: __dirname,
|
||||
outDir: 'dist',
|
||||
base,
|
||||
title: 'NocoBase Documentation',
|
||||
icon: 'https://www.nocobase.com/images/favicon/apple-touch-icon.png',
|
||||
logo: {
|
||||
light: '/logo.png',
|
||||
dark: '/logo-white.png',
|
||||
},
|
||||
route: { cleanUrls: true },
|
||||
builderConfig: { plugins: [pluginSass()] },
|
||||
plugins: [pluginSitemap({ siteUrl: 'https://docs.nocobase.com' })],
|
||||
lang: '$lang',
|
||||
locales: [{ lang: '$lang', label: '$lang', title: 'NocoBase Documentation', description: 'NocoBase Documentation' }],
|
||||
themeConfig: {
|
||||
socialLinks: [{ icon: 'github', mode: 'link', content: 'https://github.com/nocobase/nocobase' }],
|
||||
},
|
||||
});
|
||||
EOF
|
||||
|
||||
# 6. Create README
|
||||
cat > "$REPO_DIR/README.md" << EOF
|
||||
# NocoBase Documentation - $lang
|
||||
|
||||
This repository contains the $lang translation of NocoBase documentation.
|
||||
|
||||
## Development
|
||||
|
||||
\`\`\`bash
|
||||
pnpm install
|
||||
pnpm dev
|
||||
\`\`\`
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork this repository
|
||||
2. Make your changes
|
||||
3. Submit a Pull Request
|
||||
|
||||
## License
|
||||
|
||||
Same as the main NocoBase repository.
|
||||
EOF
|
||||
|
||||
# 7. Initialize git and commit
|
||||
echo "Initializing git..."
|
||||
cd "$REPO_DIR"
|
||||
git init -q
|
||||
git add -A
|
||||
git commit -q -m "Initial commit: $lang documentation"
|
||||
|
||||
# 8. Create GitHub repo and push
|
||||
echo "Creating GitHub repo..."
|
||||
gh repo create "Albert-mah/$REPO_NAME" --public --description "NocoBase Documentation - $lang" -y 2>/dev/null || true
|
||||
|
||||
echo "Pushing to GitHub..."
|
||||
git remote add origin "git@github.com:Albert-mah/$REPO_NAME.git" 2>/dev/null || git remote set-url origin "git@github.com:Albert-mah/$REPO_NAME.git"
|
||||
git push -u origin main -f
|
||||
|
||||
# 9. Remove from main repo and add as submodule
|
||||
echo "Setting up submodule..."
|
||||
cd "$MAIN_REPO"
|
||||
rm -rf "$DOCS_DIR/$lang"
|
||||
git add "$DOCS_DIR/$lang"
|
||||
|
||||
# Add submodule
|
||||
git submodule add "https://github.com/Albert-mah/$REPO_NAME.git" "docs/docs/$lang" 2>/dev/null || true
|
||||
|
||||
echo "Done: $lang"
|
||||
echo ""
|
||||
done
|
||||
|
||||
echo "======================================"
|
||||
echo "All languages processed!"
|
||||
echo "======================================"
|
||||
Reference in New Issue
Block a user