Skip to content

Commit 00e0725

Browse files
Merge pull request #96 from move-elevator/vitepress-docs
docs: use vitepress for GitHub pages docs
2 parents ee6ecf7 + db5df2f commit 00e0725

24 files changed

Lines changed: 2093 additions & 1160 deletions

.gitattributes

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
/.github export-ignore
33
/bin export-ignore
44
/docker export-ignore
5-
/docs/build export-ignore
6-
/docs/hooks.py export-ignore
5+
/docs export-ignore
76
/tests export-ignore
87
/.dockerignore export-ignore
98
/.editorconfig export-ignore
@@ -13,7 +12,7 @@
1312
/codecov.yml export-ignore
1413
/composer.lock export-ignore
1514
/Dockerfile export-ignore
16-
/mkdocs.yml export-ignore
15+
/package.json export-ignore
1716
/phpstan.neon export-ignore
1817
/phpunit.xml export-ignore
1918
/phpunit.coverage.xml export-ignore

.github/workflows/docs.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- 'package.json'
10+
- '.github/workflows/docs.yml'
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Setup Node
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
cache: npm
36+
37+
- name: Setup Pages
38+
uses: actions/configure-pages@v4
39+
40+
- name: Install dependencies
41+
run: npm ci
42+
43+
- name: Build with VitePress
44+
run: npm run docs:build
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: docs/.vitepress/dist
50+
51+
deploy:
52+
environment:
53+
name: github-pages
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
needs: build
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Deploy to GitHub Pages
59+
id: deployment
60+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@
99
/site
1010
/tests/composer.lock
1111
/tests/vendor
12+
13+
# Node.js / VitePress
14+
node_modules/
15+
docs/.vitepress/cache/
16+
docs/.vitepress/dist/
17+
package-lock.json

README.md

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ A Composer plugin that validates translation files in your project.
1313
Provides a command `validate-translations` to check for translations mismatches, duplicates, schema validation and more.
1414
Supports XLIFF, YAML, JSON and PHP translation files.
1515

16+
**[View Documentation](https://move-elevator.github.io/composer-translation-validator/)**
17+
1618
## ✨ Features
1719

1820
* Autodetect coherent language files
19-
* Supports various [translation file formats](#supported-file-formats)
20-
* Provides multiple [validators](#translation-validators)
21-
* Configurable via separate [configuration files](docs/config-file.md)
21+
* Supports various [translation file formats](https://move-elevator.github.io/composer-translation-validator/reference/file-formats)
22+
* Provides multiple [validators](https://move-elevator.github.io/composer-translation-validator/reference/validators)
23+
* Configurable via separate [configuration files](https://move-elevator.github.io/composer-translation-validator/configuration/)
2224

2325
## 🔥 Installation
2426

@@ -40,42 +42,20 @@ composer validate-translations ./translations
4042

4143
![console.png](docs/images/console.png)
4244

43-
The command `validate-translations` can be used to validate translation files in your project. It will automatically detect the translation files based on the [supported formats](#supported-file-formats) and run the configured [validators]((#translation-validators)). See the [console command documentation](docs/console-command.md) for more details.
45+
The command `validate-translations` can be used to validate translation files in your project. It will automatically detect the translation files based on the [supported formats](https://move-elevator.github.io/composer-translation-validator/reference/file-formats) and run the configured [validators](https://move-elevator.github.io/composer-translation-validator/reference/validators). See the [CLI documentation](https://move-elevator.github.io/composer-translation-validator/reference/cli) for more details.
4446

4547
## 📝 Documentation
4648

47-
### Supported File Formats
48-
49-
Translations will be detected and grouped by the following file formats (regarding the associated frameworks):
50-
51-
| Format | Frameworks | Example files |
52-
|--------|------------|----------------------------------------|
53-
| [XLIFF](docs/file-detector.md#xliff-xml-localization-interchange-file-format) | TYPO3 CMS | `locallang.xlf`, `de.locallang.xlf` |
54-
| [YAML](docs/file-detector.md#yaml-yaml-aint-markup-language) | Symfony | `messages.en.yaml`, `messages.de.yaml` |
55-
| [JSON](docs/file-detector.md#json-javascript-object-notation) | Laravel, Symfony | `messages.en.json`, `messages.de.json` |
56-
| [PHP](docs/file-detector.md#php-arrays) | Laravel, Symfony | `en/messages.php`, `messages.en.php` |
57-
58-
See detailed [file format and file detection documentation](docs/file-detector.md) with examples.
59-
60-
### Translation Validators
61-
62-
The following translation validators are available (and enabled by default):
49+
Full documentation is available at **[move-elevator.github.io/composer-translation-validator](https://move-elevator.github.io/composer-translation-validator/)**.
6350

64-
| Validator | Description |
65-
|-----------|-------------|
66-
| [DuplicateKeysValidator](docs/validators.md#duplicatekeysvalidator) | Catches duplicate keys within files |
67-
| [DuplicateValuesValidator](docs/validators.md#duplicatevaluesvalidator) | Finds identical translation values |
68-
| [EmptyValuesValidator](docs/validators.md#emptyvaluesvalidator) | Detects empty or whitespace-only values |
69-
| [EncodingValidator](docs/validators.md#encodingvalidator) | Validates UTF-8 encoding and Unicode issues |
70-
| [HtmlTagValidator](docs/validators.md#htmltagvalidator) | Ensures HTML tag consistency across languages |
71-
| [KeyCountValidator](docs/validators.md#keycountvalidator) | Warns when files exceed a configurable key count threshold |
72-
| [KeyDepthValidator](docs/validators.md#keydepthvalidator) | Warns when translation keys have excessive nesting depth |
73-
| [KeyNamingConventionValidator](docs/validators.md#keynamingconventionvalidator) | Enforces key naming patterns (requires config) |
74-
| [MismatchValidator](docs/validators.md#mismatchvalidator) | Finds missing translations between files |
75-
| [PlaceholderConsistencyValidator](docs/validators.md#placeholderconsistencyvalidator) | Validates placeholder patterns |
76-
| [XliffSchemaValidator](docs/validators.md#xliffschemavalidator) | Validates XLIFF against XML schemas |
51+
### Quick Links
7752

78-
View detailed [validator documentation](docs/validators.md) with examples.
53+
- [Getting Started](https://move-elevator.github.io/composer-translation-validator/getting-started/)
54+
- [Configuration](https://move-elevator.github.io/composer-translation-validator/configuration/)
55+
- [CLI Reference](https://move-elevator.github.io/composer-translation-validator/reference/cli)
56+
- [Validators](https://move-elevator.github.io/composer-translation-validator/reference/validators)
57+
- [File Formats](https://move-elevator.github.io/composer-translation-validator/reference/file-formats)
58+
- [File Detection](https://move-elevator.github.io/composer-translation-validator/reference/file-detection)
7959

8060
## 🧑‍💻 Contributing
8161

docs/.vitepress/config.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
export default defineConfig({
4+
title: 'Composer Translation Validator',
5+
description: 'A Composer plugin that validates translation files in your project',
6+
base: '/composer-translation-validator/',
7+
8+
head: [
9+
['link', { rel: 'icon', href: '/composer-translation-validator/logo.svg' }]
10+
],
11+
12+
themeConfig: {
13+
logo: '/logo.svg',
14+
15+
nav: [
16+
{ text: 'Guide', link: '/getting-started/' },
17+
{ text: 'Configuration', link: '/configuration/' },
18+
{ text: 'Reference', link: '/reference/cli' },
19+
{
20+
text: 'Links',
21+
items: [
22+
{ text: 'Packagist', link: 'https://packagist.org/packages/move-elevator/composer-translation-validator' },
23+
{ text: 'Changelog', link: 'https://github.com/move-elevator/composer-translation-validator/releases' }
24+
]
25+
}
26+
],
27+
28+
sidebar: {
29+
'/getting-started/': [
30+
{
31+
text: 'Getting Started',
32+
items: [
33+
{ text: 'Introduction', link: '/getting-started/' },
34+
{ text: 'Installation', link: '/getting-started/installation' },
35+
{ text: 'Quick Start', link: '/getting-started/quickstart' }
36+
]
37+
}
38+
],
39+
'/configuration/': [
40+
{
41+
text: 'Configuration',
42+
items: [
43+
{ text: 'Overview', link: '/configuration/' },
44+
{ text: 'Configuration File', link: '/configuration/config-file' },
45+
{ text: 'Schema Reference', link: '/configuration/schema' }
46+
]
47+
}
48+
],
49+
'/reference/': [
50+
{
51+
text: 'Reference',
52+
items: [
53+
{ text: 'CLI Reference', link: '/reference/cli' },
54+
{ text: 'Validators', link: '/reference/validators' },
55+
{ text: 'File Formats', link: '/reference/file-formats' },
56+
{ text: 'File Detection', link: '/reference/file-detection' }
57+
]
58+
}
59+
]
60+
},
61+
62+
socialLinks: [
63+
{ icon: 'github', link: 'https://github.com/move-elevator/composer-translation-validator' }
64+
],
65+
66+
editLink: {
67+
pattern: 'https://github.com/move-elevator/composer-translation-validator/edit/main/docs/:path',
68+
text: 'Edit this page on GitHub'
69+
},
70+
71+
footer: {
72+
message: 'Released under the GPL-3.0 License.',
73+
copyright: 'Copyright 2025-2026 move elevator GmbH'
74+
},
75+
76+
search: {
77+
provider: 'local'
78+
}
79+
}
80+
})

docs/.vitepress/theme/custom.css

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/* Adjust nav bar title to accommodate longer site titles */
2+
.VPNavBarTitle {
3+
flex-shrink: 0;
4+
padding-right: 4px;
5+
}
6+
7+
.VPNavBarTitle .title {
8+
font-size: 13px;
9+
font-weight: 600;
10+
letter-spacing: -0.3px;
11+
}
12+
13+
/* Reduce search bar width to make room for title */
14+
.VPNavBarSearch {
15+
padding-left: 4px !important;
16+
}
17+
18+
.VPNavBarSearch .DocSearch-Button {
19+
width: 110px !important;
20+
min-width: 110px !important;
21+
}
22+
23+
.VPNavBarSearch .DocSearch-Button-Placeholder {
24+
display: none !important;
25+
}
26+
27+
/* Reduce spacing in nav menu */
28+
.VPNavBar .VPNavBarMenu {
29+
padding-left: 8px;
30+
}
31+
32+
/* Tighter nav items */
33+
.VPNavBarMenuLink {
34+
padding: 0 8px !important;
35+
font-size: 13px !important;
36+
}
37+
38+
/* On smaller screens */
39+
@media (max-width: 1100px) {
40+
.VPNavBarTitle .title {
41+
font-size: 12px;
42+
}
43+
44+
.VPNavBarSearch .DocSearch-Button {
45+
width: 90px !important;
46+
min-width: 90px !important;
47+
}
48+
49+
.VPNavBarMenuLink {
50+
padding: 0 6px !important;
51+
}
52+
}
53+
54+
@media (max-width: 960px) {
55+
.VPNavBarTitle .title {
56+
font-size: 11px;
57+
}
58+
}
59+
60+
@media (max-width: 768px) {
61+
.VPNavBarTitle .title {
62+
max-width: 180px;
63+
overflow: hidden;
64+
text-overflow: ellipsis;
65+
white-space: nowrap;
66+
}
67+
}

docs/.vitepress/theme/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import DefaultTheme from 'vitepress/theme'
2+
import './custom.css'
3+
4+
export default DefaultTheme

0 commit comments

Comments
 (0)