Skip to content
Open
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
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# macOS
.DS_Store

# Translation backup files (created by i18n sync scripts)
*.bak

# IntelliJ
.idea/
*.iml
Expand Down Expand Up @@ -62,4 +65,10 @@ site
*policy.local.csv

# Cursor IDE configuration files
.cursorrules
.cursorrules

# i18n staged files and cache
ui-i18n/
ui-i18n-downloads/
.ui-i18n-cache/
.ui-i18n-download-cache/
5 changes: 5 additions & 0 deletions docs/backstage-i18n-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

This guide provides comprehensive patterns for implementing internationalization in Backstage plugins. It's designed as a source of truth for both AI assistants and developers.

> **📚 Related Documentation:**
>
> - **[i18n Scripts Guide](./i18n-scripts-guide.md)** - Complete workflow and automation scripts
> - **[i18n Quick Reference](./i18n-quick-reference.md)** - Quick commands and troubleshooting

**🚨 CRITICAL**: Never modify original English strings when implementing i18n - preserve them exactly as they were

**Example Languages**: German (de), French (fr), Italian (it), Spanish (es)
Expand Down
90 changes: 90 additions & 0 deletions docs/i18n-quick-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# i18n Scripts Quick Reference

## 🚀 Quick Commands

```bash
# NEW: Two-step workflow (recommended)
yarn i18n-generate # 1. Generate JSON files
# Review files in ui-i18n/1.8/
yarn i18n-push # 2. Upload to TMS
yarn i18n-download # 3. Download translations
yarn i18n-deploy # 4. Deploy to plugins
yarn i18n-sync # 5. Sync with TypeScript (replaces AI-generated content)
yarn i18n-cleanup --force # 6. Clean backups

# Legacy: Single-step workflow
yarn i18n-upload # Generate + Upload in one step

# File management
yarn i18n-generate --force # Force regenerate files

# Get help
yarn i18n-*:help # Help for any command
```

## 📋 Common Options

| Command | Common Options | Example |
| ----------------- | --------------------------------------- | -------------------------------------------- |
| `generate` | `-r 1.9 -s 3280 --force` | `yarn i18n-generate -- --force -r 1.9` |
| `push` | `-t 'fr,es' -r 1.9` | `yarn i18n-push -- -t 'fr,es,de'` |
| `upload` (legacy) | `-r 1.9 -s 3280 -t 'fr,es' --legacy` | `yarn i18n-upload -- --legacy -t 'fr,es,de'` |
| `download` | `--languages fr,es --dry-run` | `yarn i18n-download -- --languages fr,es` |
| `deploy` | `--dry-run --clean-source` | `yarn i18n-deploy -- --dry-run` |
| `sync` | `--language fr --plugin name --dry-run` | `yarn i18n-sync -- --language fr` |
| `cleanup` | `--force --older-than 7 --interactive` | `yarn i18n-cleanup -- --older-than 7` |

## 🔧 Prerequisites Setup

```bash
# Install dependencies
brew install jq
npm install -g @memsource/cli

# Setup credentials (see team setup guide below)
cat > ~/.memsourcerc << 'EOF'
source ${HOME}/git/memsource-cli-client/.memsource/bin/activate
export MEMSOURCE_URL="https://cloud.memsource.com/web"
export MEMSOURCE_USERNAME="your-username"
export MEMSOURCE_PASSWORD="your-password"
export MEMSOURCE_TOKEN=$(memsource auth login --user-name $MEMSOURCE_USERNAME --password "${MEMSOURCE_PASSWORD}" -c token -f value)
EOF
source ~/.memsourcerc
```

## 🔗 Team Setup Guide

For detailed setup instructions including credentials and CLI client installation, see the [localization team instructions](https://docs.google.com/presentation/d/1qQH0Ppm8CR3QJX3CE8pcWiZQFtIvfDwDk1Y34PH-s-0/edit?usp=sharing).

## 📁 File Structure

```
workspaces/plugin/plugins/plugin/src/translations/
├── ref.ts # Source messages (TypeScript)
├── ref-fr.json # Downloaded from TMS
├── fr.ts # AI-generated (temp) → Synced translations (after sync)
└── fr.ts.bak # Backup (auto-created during sync)
```

## ⚠️ Troubleshooting

| Issue | Solution |
| -------------------- | -------------------------------------------------- |
| Missing dependencies | `brew install jq && npm install -g @memsource/cli` |
| Auth errors | Check `~/.memsourcerc` and `source ~/.memsourcerc` |
| Virtual env missing | Contact localization team for CLI client setup |
| Syntax errors | Run `node -c path/to/file.ts` to validate |
| Permission denied | `chmod +x scripts/i18n-scripts/*.sh` |
| No translations | Check TMS for COMPLETED status |

## 🎯 Best Practices

- ✅ Always use `--dry-run` first
- ✅ Keep backup files until verified
- ✅ Test syntax: `node -c translation-file.ts`
- ✅ Commit translation files to git
- ✅ Clean up backups regularly

## 📖 Full Documentation

See [i18n-scripts-guide.md](./i18n-scripts-guide.md) for complete documentation.
Loading