Skip to content

Conversation

@Gaming32
Copy link
Contributor

@Gaming32 Gaming32 commented Sep 11, 2025

This adds the ability for messages returned from backend to have translation keys for the frontend to translate. This is the first of two PRs. This PR sets up the framework and integrates it into labrinth. The next PR will add it to theseus.

The PR adds a type used for translation sent from the backend:

type TranslationData = string | {
	key: string
	values?: {[key: string]: TranslationData}
}

This type is used in the following places (v3 only):

  • A new translatable_error field in the ApiError type
  • A new translatable_name field in the Notification type
  • A new translatable_text field in the Notification type

It is worth noting that a large number of these messages will never be shown to any frontend user, but to avoid making the system more complex to separate "impossible" messages from "possible" ones, all messages are localizable.

@Gaming32 Gaming32 added enhancement backend Involves work from the backend team labels Sep 11, 2025
# Conflicts:
#	apps/labrinth/src/auth/email/mod.rs
#	apps/labrinth/src/routes/internal/flows.rs
#	apps/labrinth/src/routes/mod.rs
#	apps/labrinth/src/routes/v2/version_file.rs
# Conflicts:
#	apps/labrinth/src/models/v3/notifications.rs
#	apps/labrinth/src/queue/email/templates.rs
# Conflicts:
#	Cargo.toml
#	apps/labrinth/src/auth/checks.rs
#	apps/labrinth/src/models/v3/notifications.rs
#	apps/labrinth/src/routes/internal/affiliate.rs
#	apps/labrinth/src/routes/internal/billing.rs
#	apps/labrinth/src/routes/internal/medal.rs
#	apps/labrinth/src/routes/mod.rs
#	apps/labrinth/src/routes/v3/organizations.rs
#	apps/labrinth/src/routes/v3/project_creation.rs
# Conflicts:
#	.idea/code.iml
#	Cargo.lock
#	Cargo.toml
#	apps/app/Cargo.toml
#	apps/daedalus_client/Cargo.toml
#	apps/labrinth/Cargo.toml
#	apps/labrinth/src/models/v3/notifications.rs
#	apps/labrinth/src/queue/email/templates.rs
#	apps/labrinth/src/routes/internal/affiliate.rs
#	apps/labrinth/src/routes/internal/external_notifications.rs
#	apps/labrinth/src/routes/mod.rs
#	apps/labrinth/src/routes/v3/analytics_get.rs
#	apps/labrinth/src/routes/v3/collections.rs
#	packages/app-lib/Cargo.toml
#	packages/ariadne/Cargo.toml
#	packages/daedalus/Cargo.toml
#	rust-toolchain.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Involves work from the backend team

Development

Successfully merging this pull request may close these issues.

2 participants