mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
Restructure/frontend editor (#6404)
## Move editor under `frontend/editor/`
Pure restructure: `frontend/` becomes the workspace, `frontend/editor/`
holds
the PDF editor. 1775 file renames + 40 wiring edits. No logic changes.
### Why
`frontend/` is currently the editor — its `src/`, `public/`,
`src-tauri/`,
config files all sit at the root. Promoting `frontend/` to a
workspace and putting the editor in a sibling folder leaves room for
future
apps to drop in alongside it, sharing one `package.json` /
`node_modules` /
lint config / Storybook.
### What moves
frontend/
├── editor/ ← NEW: everything editor-specific
│ ├── src/ ← was frontend/src/
│ ├── public/ ← was frontend/public/
│ ├── src-tauri/ ← was frontend/src-tauri/
│ ├── index.html, vite.config.ts, vitest.config.ts, playwright.config.ts
│ ├── tsconfig*.json, tailwind.config.js, postcss.config.js
│ ├── scripts/
│ ├── .env, .env.desktop, .env.saas
│ └── DeveloperGuide.md
├── package.json, package-lock.json, node_modules/ ← workspace install
├── eslint.config.mjs, .prettierrc, .prettierignore ← shared tooling
├── .gitignore
└── README.md
### Wiring edits (40 files)
- `.taskfiles/frontend.yml`, `desktop.yml`, `e2e.yml`
- `build.gradle`, `app/core/build.gradle`
- `eslint.config.mjs`, `frontend/package.json`, `.gitignore`,
`.prettierignore`
- `docker/frontend/Dockerfile`
- 8 `.github/workflows/*.yml`, plus `.github/dependabot.yml`,
`.github/config/.files.yaml`, `.github/labeler-config-srvaroa.yml`
- `scripts/translations/**`
- Docs: `AGENTS.md`, `CLAUDE.md`, `ADDING_TOOLS.md`,
`DeveloperGuide.md`,
`WINDOWS_SIGNING.md`, `devGuide/HowToAddNewLanguage.md`,
`frontend/README.md`,
`frontend/editor/DeveloperGuide.md`
Plus 3 renamed + edited: `editor/vite.config.ts` (env path +
node_modules
walk-up), `editor/scripts/setup-env.mts` (renamed from `.ts` for
`import.meta.url`), `editor/scripts/build-provisioner.mjs` (resolve
src-tauri
relative to script).
### Verification
| Check | Result |
|---|---|
| `task frontend:typecheck:all` (6 variants) | exit 0 |
| `task frontend:lint` (eslint + dpdm) | exit 0 |
| `task frontend:format:check` | exit 0 |
| `task frontend:test` | 657 tests pass, 50 files |
| `task frontend:build:{core,proprietary,saas,desktop,prototypes}` | all
green |
| `task desktop:build` | full Tauri pipeline →
`Stirling-PDF_2.11.0_x64_en-US.msi` |
| `playwright test --list --project=stubbed` | 172 tests discovered |
`task desktop:build` exercises the heaviest path — Rust + WiX + MSI
bundle
against the moved `editor/src-tauri/`. If anything in the restructure
was
wrong it wouldn't have built.
### Test plan
- [ ] `frontend-validation.yml` green
- [ ] `e2e-stubbed.yml` green
- [ ] `tauri-build.yml` green on at least one platform
- [ ] `check_toml.yml` runs on a translation-touching PR
---------
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
48027ee9d6
commit
0a50e765b7
@@ -3,8 +3,8 @@ A script to update language progress status in README.md based on
|
||||
frontend locale TOML file comparisons.
|
||||
|
||||
This script compares the default (reference) TOML file,
|
||||
`frontend/public/locales/en-GB/translation.toml`, with other translation
|
||||
files in `frontend/public/locales/*/translation.toml`.
|
||||
`frontend/editor/public/locales/en-GB/translation.toml`, with other translation
|
||||
files in `frontend/editor/public/locales/*/translation.toml`.
|
||||
It determines how many keys are fully translated and automatically updates
|
||||
progress badges in the `README.md`.
|
||||
|
||||
@@ -21,7 +21,7 @@ Usage:
|
||||
$ python scripts/counter_translation_v3.py
|
||||
|
||||
This will:
|
||||
• Compare all files matching frontend/public/locales/*/translation.toml
|
||||
• Compare all files matching frontend/editor/public/locales/*/translation.toml
|
||||
• Update progress badges in README.md
|
||||
• Update/format ignore_translation.toml automatically
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ This directory contains Python scripts for managing frontend translations in Sti
|
||||
|
||||
## Current Format: TOML
|
||||
|
||||
**Stirling PDF uses TOML format for translations** in `frontend/public/locales/{lang}/translation.toml`.
|
||||
**Stirling PDF uses TOML format for translations** in `frontend/editor/public/locales/{lang}/translation.toml`.
|
||||
|
||||
**All scripts now support TOML format!**
|
||||
|
||||
@@ -190,7 +190,7 @@ python scripts/translations/translation_merger.py fr-FR create-template --output
|
||||
python scripts/translations/translation_merger.py fr-FR apply-translations --translations-file fr_translated.json
|
||||
|
||||
# Override default paths if needed
|
||||
python scripts/translations/translation_merger.py fr-FR add-missing --locales-dir ./frontend/public/locales --ignore-file ./scripts/ignore_translation.toml
|
||||
python scripts/translations/translation_merger.py fr-FR add-missing --locales-dir ./frontend/editor/public/locales --ignore-file ./scripts/ignore_translation.toml
|
||||
|
||||
# Remove unused translations not present in en-GB
|
||||
python scripts/translations/translation_merger.py fr-FR remove-unused
|
||||
@@ -302,7 +302,7 @@ python3 scripts/translations/auto_translate.py es-ES --skip-verification
|
||||
- Uses appropriate formal/informal tone per language
|
||||
|
||||
**Supported Languages:**
|
||||
All language codes from `frontend/public/locales/` (e.g., es-ES, de-DE, fr-FR, zh-CN, ar-AR, etc.)
|
||||
All language codes from `frontend/editor/public/locales/` (e.g., es-ES, de-DE, fr-FR, zh-CN, ar-AR, etc.)
|
||||
|
||||
### 6. `batch_translator.py` - GPT-5 Translation Engine
|
||||
|
||||
@@ -469,7 +469,7 @@ python scripts/translations/translation_merger.py fr-FR apply-translations --tra
|
||||
|
||||
## Translation File Structure
|
||||
|
||||
Translation files are located in `frontend/public/locales/{language}/translation.toml` with TOML structure:
|
||||
Translation files are located in `frontend/editor/public/locales/{language}/translation.toml` with TOML structure:
|
||||
|
||||
```toml
|
||||
[addPageNumbers]
|
||||
@@ -685,7 +685,7 @@ python scripts/translations/ai_translation_helper.py apply-batch de_batch_1.json
|
||||
## Integration with Development
|
||||
|
||||
These scripts integrate with the existing translation system:
|
||||
- Works with the current `frontend/public/locales/` structure
|
||||
- Works with the current `frontend/editor/public/locales/` structure
|
||||
- Compatible with the i18n system used in the React frontend
|
||||
- Respects the JSON format expected by the translation loader
|
||||
- Maintains the nested structure required by the UI components
|
||||
|
||||
@@ -18,7 +18,7 @@ import tomli_w
|
||||
|
||||
|
||||
class AITranslationHelper:
|
||||
def __init__(self, locales_dir: str = "frontend/public/locales"):
|
||||
def __init__(self, locales_dir: str = "frontend/editor/public/locales"):
|
||||
self.locales_dir = Path(locales_dir)
|
||||
self.golden_truth_file = self.locales_dir / "en-GB" / "translation.toml"
|
||||
|
||||
@@ -391,7 +391,7 @@ def main():
|
||||
)
|
||||
parser.add_argument(
|
||||
"--locales-dir",
|
||||
default="frontend/public/locales",
|
||||
default="frontend/editor/public/locales",
|
||||
help="Path to locales directory",
|
||||
)
|
||||
|
||||
|
||||
@@ -55,16 +55,20 @@ def extract_untranslated(language_code, batch_size=500, include_existing=False):
|
||||
print(f"\n🔍 Extracting {mode} entries for {language_code}...")
|
||||
|
||||
# Load files
|
||||
golden_path = find_translation_file(Path("frontend/public/locales/en-GB"))
|
||||
lang_path = find_translation_file(Path(f"frontend/public/locales/{language_code}"))
|
||||
golden_path = find_translation_file(Path("frontend/editor/public/locales/en-GB"))
|
||||
lang_path = find_translation_file(
|
||||
Path(f"frontend/editor/public/locales/{language_code}")
|
||||
)
|
||||
|
||||
if not golden_path:
|
||||
print("Error: Golden truth file not found in frontend/public/locales/en-GB")
|
||||
print(
|
||||
"Error: Golden truth file not found in frontend/editor/public/locales/en-GB"
|
||||
)
|
||||
return None
|
||||
|
||||
if not lang_path:
|
||||
print(
|
||||
f"Error: Language file not found in frontend/public/locales/{language_code}"
|
||||
f"Error: Language file not found in frontend/editor/public/locales/{language_code}"
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ Note: Requires OPENAI_API_KEY environment variable or --api-key argument.
|
||||
)
|
||||
parser.add_argument(
|
||||
"--locales-dir",
|
||||
default="frontend/public/locales",
|
||||
default="frontend/editor/public/locales",
|
||||
help="Path to locales directory",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -15,7 +15,7 @@ import tomllib # Python 3.11+ (stdlib)
|
||||
class CompactTranslationExtractor:
|
||||
def __init__(
|
||||
self,
|
||||
locales_dir: str = "frontend/public/locales",
|
||||
locales_dir: str = "frontend/editor/public/locales",
|
||||
ignore_file: str = "scripts/ignore_translation.toml",
|
||||
):
|
||||
self.locales_dir = Path(locales_dir)
|
||||
@@ -143,7 +143,7 @@ def main():
|
||||
parser.add_argument("language", help="Language code (e.g., de-DE, fr-FR)")
|
||||
parser.add_argument(
|
||||
"--locales-dir",
|
||||
default="frontend/public/locales",
|
||||
default="frontend/editor/public/locales",
|
||||
help="Path to locales directory",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -15,7 +15,7 @@ import tomli_w
|
||||
|
||||
|
||||
class TOMLBeautifier:
|
||||
def __init__(self, locales_dir: str = "frontend/public/locales"):
|
||||
def __init__(self, locales_dir: str = "frontend/editor/public/locales"):
|
||||
self.locales_dir = Path(locales_dir)
|
||||
self.golden_truth_file = self.locales_dir / "en-GB" / "translation.toml"
|
||||
self.golden_structure = self._load_toml(self.golden_truth_file)
|
||||
@@ -225,7 +225,7 @@ def main():
|
||||
)
|
||||
parser.add_argument(
|
||||
"--locales-dir",
|
||||
default="frontend/public/locales",
|
||||
default="frontend/editor/public/locales",
|
||||
help="Path to locales directory",
|
||||
)
|
||||
parser.add_argument("--language", help="Restructure specific language only")
|
||||
|
||||
@@ -15,7 +15,7 @@ import tomllib
|
||||
class TranslationAnalyzer:
|
||||
def __init__(
|
||||
self,
|
||||
locales_dir: str = "frontend/public/locales",
|
||||
locales_dir: str = "frontend/editor/public/locales",
|
||||
ignore_file: str = "scripts/ignore_translation.toml",
|
||||
):
|
||||
self.locales_dir = Path(locales_dir)
|
||||
@@ -208,7 +208,7 @@ def main():
|
||||
)
|
||||
parser.add_argument(
|
||||
"--locales-dir",
|
||||
default="frontend/public/locales",
|
||||
default="frontend/editor/public/locales",
|
||||
help="Path to locales directory",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
||||
@@ -119,7 +119,7 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
# Define paths
|
||||
locales_dir = Path("frontend/public/locales")
|
||||
locales_dir = Path("frontend/editor/public/locales")
|
||||
en_gb_path = locales_dir / "en-GB" / "translation.toml"
|
||||
|
||||
if not en_gb_path.exists():
|
||||
|
||||
@@ -112,7 +112,7 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
# Define paths
|
||||
locales_dir = Path("frontend/public/locales")
|
||||
locales_dir = Path("frontend/editor/public/locales")
|
||||
en_gb_path = locales_dir / "en-GB" / "translation.toml"
|
||||
|
||||
if not en_gb_path.exists():
|
||||
|
||||
Reference in New Issue
Block a user