Skip to content

Commit 065e62c

Browse files
authored
Merge pull request #13 from pie-framework/develop
Develop
2 parents 0ede205 + 206889d commit 065e62c

114 files changed

Lines changed: 12709 additions & 673 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
"access": "public",
88
"baseBranch": "master",
99
"updateInternalDependencies": "patch",
10-
"ignore": ["@acme/likert-scale-plugin", "@pie-qti/qti2-example"]
10+
"ignore": ["@acme/likert-scale-plugin", "@pie-qti/qti2-example", "@pie-qti/transform-cli"]
1111
}

.github/workflows/release.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
paths:
1111
- ".changeset/**"
1212
- "packages/**"
13+
- "tools/**"
1314
- "package.json"
1415
- "bun.lock"
1516
- "turbo.json"
@@ -89,7 +90,7 @@ jobs:
8990
after="${{ github.sha }}"
9091
changed="$(git diff --name-only "$before" "$after" || true)"
9192
92-
if echo "$changed" | grep -Eq '^packages/[^/]+/(package\.json|CHANGELOG\.md)$'; then
93+
if echo "$changed" | grep -Eq '^(packages|tools)/[^/]+/(package\.json|CHANGELOG\.md)$'; then
9394
echo "has_version_bumps=true" >> "$GITHUB_OUTPUT"
9495
else
9596
echo "has_version_bumps=false" >> "$GITHUB_OUTPUT"
@@ -127,8 +128,9 @@ jobs:
127128
env:
128129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129130
with:
130-
tag_name: ${{ steps.changesets.outputs.publishedPackages[0].version }}
131-
release_name: Release ${{ steps.changesets.outputs.publishedPackages[0].version }}
131+
# changesets/action outputs `publishedPackages` as a JSON string; parse it before indexing.
132+
tag_name: v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}
133+
release_name: Release v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}
132134
body: |
133135
## Changes
134136

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ Components render via web components (Shadow DOM) with a CSS variable contract:
8080

8181
See [STYLING.md](packages/qti2-default-components/STYLING.md) for the full styling contract.
8282

83+
### Internationalization (i18n)
84+
85+
The player UI supports multiple languages with runtime locale switching:
86+
87+
- **Type-safe translations** — TypeScript autocomplete for all message keys
88+
- **Runtime switching** — Change language without page reload
89+
- **Small bundle** — <10 KB gzipped (core + default locale)
90+
91+
See [`@pie-qti/qti2-i18n`](packages/qti2-i18n/) for the complete i18n API and migration guide.
92+
8393
---
8494

8595
## Part 2: PIE ↔ QTI Transformation Framework
@@ -183,7 +193,7 @@ bun run preview:pages
183193

184194
- **[Transformation Guide](docs/PIE-QTI-TRANSFORMATION-GUIDE.md)** — Bidirectional transform overview
185195
- **[Transform App](packages/transform-app/README.md)** — Web UI for transformations
186-
- **[CLI](packages/cli/README.md)** — Command-line batch operations
196+
- **[CLI](tools/cli/README.md)** — Command-line batch operations
187197
- **[QTI → PIE](packages/qti2-to-pie/README.md)** — QTI to PIE transformer
188198
- **[PIE → QTI](packages/pie-to-qti2/README.md)** — PIE to QTI transformer
189199
- **[IMS Content Packages](packages/pie-to-qti2/docs/MANIFEST-GENERATION.md)** — Manifest generation

bun.lock

Lines changed: 45 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/ARCHITECTURE.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Everything lives under `packages/`:
4848

4949
### Optional adapters / supporting packages
5050

51+
- `packages/qti2-i18n`: Internationalization (i18n) system for player UI (type-safe translations, runtime locale switching)
5152
- `packages/qti2-typeset-katex`: KaTeX typesetting adapter (host-provided `typeset()` function)
5253
- `packages/qti-processing`: response processing operators/templates used by the item player
5354
- `packages/qti2-player-elements`, `packages/web-component-loaders`: web-component build/load helpers
@@ -244,6 +245,102 @@ Key references:
244245

245246
---
246247

248+
## Internationalization (i18n)
249+
250+
> **Status**: Production-ready
251+
> **Package**: `@pie-qti/qti2-i18n`
252+
253+
### Overview
254+
255+
The PIE-QTI player includes a lightweight, type-safe internationalization system for translating player UI strings (buttons, labels, error messages, ARIA text, etc.).
256+
257+
**Note**: This system translates the **player interface**, not QTI assessment content. Assessments are authored in the content creator's chosen language.
258+
259+
### Key features
260+
261+
- **Type-safe translations**: TypeScript autocomplete for all message keys
262+
- **Runtime locale switching**: Change language without page reload or component remount
263+
- **Reactive updates**: Svelte store integration automatically updates all UI text
264+
- **Web Component compatible**: Works within Shadow DOM boundaries via context API
265+
- **Small bundle size**: <10 KB gzipped (core + default English locale)
266+
- **On-demand loading**: Additional locales loaded asynchronously when needed
267+
268+
### Supported locales (Priority 1)
269+
270+
| Locale Code | Language |
271+
|-------------|-----------------------------|
272+
| `en-US` | English (United States) |
273+
| `es-ES` | Spanish (Spain) |
274+
| `fr-FR` | French (France) |
275+
| `de-DE` | German (Germany) |
276+
| `pt-BR` | Portuguese (Brazil) |
277+
278+
### Architecture
279+
280+
The i18n system consists of:
281+
282+
1. **Core I18n class** (`I18n.ts`) - Message lookup, interpolation, pluralization, number/date formatting
283+
2. **Svelte store integration** (`store.ts`) - Reactive `$t`, `$formatNumber`, `$formatDate` stores
284+
3. **Context API** (`context.ts`) - Pass i18n instance through component tree (including Shadow DOM)
285+
4. **Locale files** (`locales/*.ts`) - TypeScript modules with structured translation messages
286+
5. **LocaleSwitcher component** - Dropdown UI for runtime locale selection
287+
288+
### Usage in components
289+
290+
```svelte
291+
<script lang="ts">
292+
import { t } from '@pie-qti/qti2-i18n';
293+
</script>
294+
295+
<!-- Simple translation -->
296+
<button>{$t('common.submit')}</button>
297+
298+
<!-- With interpolation -->
299+
<p>{$t('assessment.question', { current: 1, total: 10 })}</p>
300+
301+
<!-- Error messages -->
302+
<div class="alert">{$t('interactions.upload.errorInvalidType', { types: 'pdf, jpg' })}</div>
303+
```
304+
305+
### Initialization
306+
307+
Initialize i18n in the application root (e.g., `+layout.svelte`):
308+
309+
```typescript
310+
import { initI18n } from '@pie-qti/qti2-i18n';
311+
312+
const i18n = initI18n('en-US');
313+
await i18n.loadLocale('en-US');
314+
```
315+
316+
### Message namespaces
317+
318+
Translations are organized by feature:
319+
320+
- `common.*` - Shared UI text (Submit, Cancel, Next, etc.)
321+
- `units.*` - Unit formatting (bytes, KB, seconds, etc.)
322+
- `validation.*` - Form validation messages
323+
- `interactions.*` - QTI interaction-specific text (organized by interaction type)
324+
- `assessment.*` - Assessment player UI (navigation, sections, timer, feedback)
325+
- `accessibility.*` - ARIA labels and screen reader announcements
326+
327+
### Type safety
328+
329+
Message keys are automatically typed from the English locale structure. IDEs provide autocomplete and compile-time validation:
330+
331+
```typescript
332+
$t('common.submit') // ✅ Valid
333+
$t('invalid.key') // ❌ TypeScript error
334+
```
335+
336+
### Key references
337+
338+
- `packages/qti2-i18n/README.md` - Full API documentation and migration guide
339+
- `docs/i18n-design-plan.md` - Detailed design document with architecture rationale
340+
- `packages/qti2-i18n/src/locales/en-US.ts` - Complete list of available translation keys
341+
342+
---
343+
247344
## Transformations: QTI ↔ PIE
248345

249346
> **Status**: Under active development

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Comprehensive architecture and implementation plan for the QTI Batch Processor w
7272

7373
- **Getting Started:** See main [README.md](../README.md) in repo root
7474
- **Web App Development:** Follow BATCH_PROCESSOR_ARCHITECTURE.md phases
75-
- **CLI Tools:** See `packages/cli/README.md`
75+
- **CLI Tools:** See `tools/cli/README.md`
7676

7777
### Specs (local snapshots for fast search / LLM use)
7878

0 commit comments

Comments
 (0)