Skip to content
Merged
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
2 changes: 1 addition & 1 deletion apps/website/e2e/learning.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ test.describe('Learning tutorial page @smoke', () => {
).toHaveAttribute('href', '/learning')
await expect(
breadcrumb.getByRole('link', {
name: t(`learning.categories.${firstTutorial.category}`, 'en')
name: t(`learning.categories.${firstTutorial.category}.label`, 'en')
})
).toHaveAttribute('href', `/learning/${firstTutorial.category}`)
await expect(breadcrumb.getByText(firstTutorial.title.en)).toBeVisible()
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/demos/ArcadeEmbed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const loaded = ref(false)

<noscript>
<p class="text-primary-warm-gray mt-4 text-sm">
{{ t('demos.noscript', locale) }}
{{ t('demos.noscript.text', locale) }}
<a
class="text-primary-comfy-yellow ml-2 underline"
:href="`https://demo.arcade.software/${arcadeId}`"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface NavOption {

const navOptions: readonly NavOption[] = [
{
labelKey: 'learning.categories.all',
labelKey: 'learning.categories.all.label',
blurbKey: 'learning.categories.all.blurb',
href: '/learning'
},
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/workshop/WorkshopCatalog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const outputOptions: readonly WorkshopOutputFilter[] = [
class="rounded-2xl border border-primary-comfy-canvas/10 p-12"
>
<p class="text-center text-primary-comfy-canvas/60">
{{ t('workshop.empty', locale) }}
{{ t('workshop.empty.message', locale) }}
</p>
</div>
</template>
8 changes: 4 additions & 4 deletions apps/website/src/data/learningTutorials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ export const learningCategories: readonly LearningCategory[] = [
]

export const categoryLabelKeys: Record<LearningCategory, TranslationKey> = {
basics: 'learning.categories.basics',
vfx: 'learning.categories.vfx',
animations: 'learning.categories.animations',
ads: 'learning.categories.ads'
basics: 'learning.categories.basics.label',
vfx: 'learning.categories.vfx.label',
animations: 'learning.categories.animations.label',
ads: 'learning.categories.ads.label'
}

export const categoryBlurbKeys: Record<LearningCategory, TranslationKey> = {
Expand Down
15 changes: 14 additions & 1 deletion apps/website/src/i18n/translations.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import { describe, expect, it } from 'vitest'

import { t } from './translations'
import { t, translationKeys } from './translations'

describe('translation keys', () => {
it('never uses a key as the prefix of another key', () => {
const keys = new Set<string>(translationKeys)
const collisions = translationKeys.filter((key) => {
const segments = key.split('.')
return segments
.slice(1)
.some((_, index) => keys.has(segments.slice(0, index + 1).join('.')))
})
expect(collisions).toEqual([])
})
})

describe('t() fallback semantics', () => {
it('returns Japanese copy when it exists', () => {
Expand Down
22 changes: 11 additions & 11 deletions apps/website/src/i18n/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const translations = {
en: '{count} models',
'zh-CN': '{count} 个模型'
},
'workshop.empty': {
'workshop.empty.message': {
en: 'No models match your filters.',
'zh-CN': '没有符合这些筛选条件的模型。'
},
Expand Down Expand Up @@ -2555,27 +2555,27 @@ Enterprise`
},
'learning.categoryNav': { en: 'Category filter', 'zh-CN': '分类筛选' },
'learning.featuredBadge': { en: 'Featured', 'zh-CN': '精选' },
'learning.categories.all': { en: 'All', 'zh-CN': '全部' },
'learning.categories.all.label': { en: 'All', 'zh-CN': '全部' },
'learning.categories.all.blurb': {
en: 'Every tutorial and workflow',
'zh-CN': '所有教程与工作流'
},
'learning.categories.basics': { en: 'Basics', 'zh-CN': '基础' },
'learning.categories.basics.label': { en: 'Basics', 'zh-CN': '基础' },
'learning.categories.basics.blurb': {
en: 'Fundamentals and getting started',
'zh-CN': '基础入门与上手指南'
},
'learning.categories.vfx': { en: 'VFX', 'zh-CN': 'VFX' },
'learning.categories.vfx.label': { en: 'VFX', 'zh-CN': 'VFX' },
'learning.categories.vfx.blurb': {
en: 'Compositing, cleanup and shot work',
'zh-CN': '合成、清理与镜头处理'
},
'learning.categories.animations': { en: 'Animations', 'zh-CN': '动画' },
'learning.categories.animations.label': { en: 'Animations', 'zh-CN': '动画' },
'learning.categories.animations.blurb': {
en: 'Motion, retiming and character',
'zh-CN': '运动、变速与角色'
},
'learning.categories.ads': { en: 'Ads', 'zh-CN': '广告' },
'learning.categories.ads.label': { en: 'Ads', 'zh-CN': '广告' },
'learning.categories.ads.blurb': {
en: 'Product shots and campaign assets',
'zh-CN': '产品展示与广告素材'
Expand Down Expand Up @@ -6221,7 +6221,7 @@ Enterprise`
en: 'Loading interactive demo…',
'zh-CN': '正在加载互动演示…'
},
'demos.noscript': {
'demos.noscript.text': {
en: 'This interactive demo requires JavaScript.',
'zh-CN': '此互动演示需要 JavaScript。'
},
Expand Down Expand Up @@ -9544,7 +9544,7 @@ Enterprise`
'workshop.task.video': { en: 'Video', 'zh-CN': '视频' },
'workshop.task.audio': { en: 'Audio', 'zh-CN': '音频' },
'workshop.models.heading': { en: 'Models', 'zh-CN': '模型' },
'workshop.proto.version': { en: 'Version', 'zh-CN': '版本' },
'workshop.proto.version.label': { en: 'Version', 'zh-CN': '版本' },
'workshop.proto.version.v1': {
en: 'Discarded · Categories in tabs',
'zh-CN': '已弃用 · 标签页分类'
Expand Down Expand Up @@ -10558,7 +10558,7 @@ Enterprise`
en: 'Show the featured row',
'zh-CN': '显示精选行'
},
'workshop.proto.session': { en: 'Session', 'zh-CN': '会话' },
'workshop.proto.session.label': { en: 'Session', 'zh-CN': '会话' },
'workshop.proto.session.signedOut': { en: 'Signed out', 'zh-CN': '未登录' },
'workshop.proto.session.new': {
en: 'New account (no credits yet)',
Expand All @@ -10570,7 +10570,7 @@ Enterprise`
},
'workshop.proto.subscribed': { en: 'Subscribed', 'zh-CN': '已订阅' },
'workshop.proto.zeroBalance': { en: 'Zero balance', 'zh-CN': '零余额' },
'workshop.proto.outcome': {
'workshop.proto.outcome.label': {
en: 'Simulate run outcome',
'zh-CN': '模拟运行结果'
},
Expand All @@ -10591,7 +10591,7 @@ Enterprise`
en: 'Rate limit (429)',
'zh-CN': '限流 (429)'
},
'workshop.proto.gate': {
'workshop.proto.gate.label': {
en: 'Simulate model state',
'zh-CN': '模拟模型状态'
},
Expand Down
Loading