Skip to content

Commit 9e49da7

Browse files
authored
Merge pull request #21 from pie-framework/develop
fixed more i18n labels, improved detection, fixes for transform app
2 parents 51d13cd + 7982efd commit 9e49da7

43 files changed

Lines changed: 731 additions & 322 deletions

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,24 @@ jobs:
6666
cd packages/qti2-i18n
6767
bun run check-translations
6868
69+
hardcoded-strings:
70+
name: Hardcoded String Scan (Informational)
71+
runs-on: ubuntu-latest
72+
continue-on-error: true
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@v4
76+
77+
- name: Setup Bun
78+
uses: oven-sh/setup-bun@v2
79+
with:
80+
bun-version: 1.3.5
81+
82+
- name: Scan for hardcoded strings
83+
run: |
84+
cd packages/qti2-i18n
85+
bun run scan-hardcoded
86+
6987
test-unit:
7088
name: Unit Tests
7189
runs-on: ubuntu-latest

packages/qti2-default-components/src/plugins/associate/AssociateInteraction.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129

130130
<!-- Display current pairs -->
131131
{#if pairs.length > 0}
132-
<div part="pairs-title" class="divider">Current Associations</div>
132+
<div part="pairs-title" class="divider">{i18n?.t('interactions.associate.currentAssociations') ?? 'Current Associations'}</div>
133133
<div part="pairs" class="qti-associate-pairs space-y-2">
134134
{#each pairs as pair, index}
135135
{@const [id1, id2] = pair.split(' ')}

packages/qti2-default-components/src/plugins/choice/ChoiceInteraction.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
<div bind:this={rootElement} part="root" class="qti-choice-interaction space-y-2" use:typesetAction={{ typeset }}>
6565
{#if !parsedInteraction}
66-
<div class="alert alert-error">{t('common.errorNoData', 'No interaction data provided')}</div>
66+
<div class="alert alert-error">{i18n?.t('common.errorNoData') ?? 'No interaction data provided'}</div>
6767
{:else if parsedInteraction.maxChoices === 1}
6868
<!-- Single choice (radio buttons) -->
6969
{#each parsedInteraction.choices as choice}

packages/qti2-default-components/src/plugins/end-attempt/EndAttemptInteraction.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
d="M5 13l4 4L19 7"
8282
/>
8383
</svg>
84-
{parsedInteraction.countAttempt ? 'Attempt Ended' : 'Requested'}
84+
{parsedInteraction.countAttempt ? (i18n?.t('interactions.endAttempt.ended') ?? 'Attempt Ended') : (i18n?.t('interactions.endAttempt.requested') ?? 'Requested')}
8585
{:else}
8686
<svg
8787
xmlns="http://www.w3.org/2000/svg"

packages/qti2-default-components/src/plugins/gap-match/GapMatchInteraction.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
part="palette"
210210
class="qti-gm-palette flex flex-wrap gap-2 p-4 bg-base-200 rounded-lg border-2 border-base-300"
211211
role="group"
212-
aria-label="Available words to place"
212+
aria-label={i18n?.t('interactions.gapMatch.availableLabel') ?? 'Available words to place'}
213213
>
214214
<div class="qti-gm-palette-title w-full text-sm text-base-content/70 font-semibold mb-2">
215215
Available words:
@@ -241,7 +241,7 @@
241241
class="btn btn-sm btn-circle btn-error"
242242
onclick={() => clearWord(gapText.identifier)}
243243
aria-label="Remove {gapText.text} from the blanks"
244-
title="Remove word"
244+
title={i18n?.t('interactions.gapMatch.removeWord') ?? 'Remove word'}
245245
>
246246
247247
</button>

packages/qti2-default-components/src/plugins/graphic-associate/GraphicAssociateInteraction.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
<img
154154
bind:this={imageElement}
155155
src={parsedInteraction.imageData.src}
156-
alt="Association diagram"
156+
alt={i18n?.t('interactions.associate.altText') ?? 'Association diagram'}
157157
class="w-full h-full object-contain"
158158
/>
159159
{/if}
@@ -288,7 +288,7 @@
288288
<button
289289
class="btn btn-xs btn-ghost btn-circle"
290290
onclick={() => removePair(index)}
291-
aria-label="Remove association"
291+
aria-label={i18n?.t('interactions.associate.removeAssociation') ?? 'Remove association'}
292292
>
293293
<svg
294294
xmlns="http://www.w3.org/2000/svg"

packages/qti2-default-components/src/plugins/graphic-gap-match/GraphicGapMatchInteraction.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function parseCoords(hotspot: { identifier: string; shape: string; coords: strin
262262
part="labels"
263263
class="qti-ggm-labels flex flex-wrap gap-2 p-4 bg-base-200 rounded-lg border-2 border-base-300"
264264
role="group"
265-
aria-label="Available labels to place"
265+
aria-label={i18n?.t('interactions.graphicGapMatch.availableLabel') ?? 'Available labels to place'}
266266
>
267267
<div class="qti-ggm-labels-title w-full text-sm text-base-content/70 font-semibold mb-2">
268268
Available Labels:
@@ -303,7 +303,7 @@ function parseCoords(hotspot: { identifier: string; shape: string; coords: strin
303303
class="btn btn-sm btn-circle btn-error"
304304
onclick={() => clearMatch(gapText.identifier)}
305305
aria-label="Remove {gapText.text} from hotspot"
306-
title="Remove label"
306+
title={i18n?.t('interactions.graphicGapMatch.removeLabel') ?? 'Remove label'}
307307
>
308308
309309
</button>

packages/qti2-default-components/src/plugins/graphic-order/GraphicOrderInteraction.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
<img
122122
bind:this={imageElement}
123123
src={parsedInteraction.imageData.src}
124-
alt="Ordering diagram"
124+
alt={i18n?.t('interactions.graphicOrder.altText') ?? 'Ordering diagram'}
125125
class="w-full h-auto"
126126
style="width: {parsedInteraction.imageData.width}px; height: {parsedInteraction.imageData
127127
.height}px;"
@@ -135,7 +135,7 @@
135135
<div part="panel" class="qti-go-panel w-full">
136136
<div class="qti-go-card card bg-base-100 border border-base-300">
137137
<div class="qti-go-card-body card-body p-4">
138-
<h3 part="panel-title" class="qti-go-title card-title text-sm">Order (drag to reorder)</h3>
138+
<h3 part="panel-title" class="qti-go-title card-title text-sm">{i18n?.t('interactions.graphicOrder.orderHeading') ?? 'Order (drag to reorder)'}</h3>
139139
<SortableList
140140
items={parsedInteraction.hotspotChoices.map(c => ({ id: c.identifier, text: c.label }))}
141141
{orderedIds}

packages/qti2-default-components/src/plugins/hotspot/HotspotInteraction.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
{:else}
8787
<img
8888
src={parsedInteraction.imageData.src}
89-
alt="Hotspot interaction"
89+
alt={i18n?.t('interactions.hotspot.altText') ?? 'Hotspot interaction'}
9090
part="image"
9191
class="qti-hotspot-image"
9292
/>

packages/qti2-default-components/src/plugins/hottext/HottextInteraction.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
part="content"
185185
class="hottext-content qti-hottext-content prose max-w-none"
186186
role="group"
187-
aria-label="Text selection interaction"
187+
aria-label={i18n?.t('interactions.hottext.ariaLabel') ?? 'Text selection interaction'}
188188
>
189189
{@html parsedInteraction.contentHtml}
190190
</div>

0 commit comments

Comments
 (0)