Add template i18n with Liquid t filter#271
Closed
Swahjak wants to merge 20 commits intoNotifuse:mainfrom
Closed
Conversation
Design for issue Notifuse#268: template-level internationalization using a Liquid `t` filter with translation key catalogs. Covers data model, API surface, rendering pipeline, migration plan, and frontend UX.
13-task TDD plan covering: translation utilities, Liquid t filter, domain model changes, V28 migration, repository/service/handler layers, rendering pipeline integration, and frontend translations panel.
7-task plan covering: OpenAPI schema/paths updates for template translations and workspace translations API, CHANGELOG v28.0 entry, CLAUDE.md Liquid filter docs, and design doc migration correction.
…spaceSettings JSONB
Locale resolution, nested key lookup, placeholder interpolation, and translation merging — pure functions with full test coverage.
Registers a TranslationFilters struct on the Liquid engine that resolves
nested keys with {{ "key" | t }} syntax and supports placeholders
via named args: {{ "key" | t: name: contact.first_name }}
Includes a patch to liquidgo (via go.mod replace) to evaluate and pass
keyword arguments to filter invocations. The t filter is registered by
default with empty translations on engine creation, so it always exists.
Template: translations (JSONB) + default_language. WorkspaceSettings: default_language + supported_languages. New WorkspaceTranslation entity with repository interface.
Adds translations JSONB and default_language columns to templates table. Creates workspace_translations table for shared translations.
CRUD operations for workspace-level translations with auth + validation.
The 'database up to date' test expected version 27 but V28 is now registered, so it needs to return 28 to be considered up to date.
Add translations and default_language fields to Template interface. Create workspace-translations API service with list, upsert, and delete operations matching the RPC-style backend endpoints.
Default language and supported languages configuration in workspace settings.
Contributor
|
Hi @Swahjak , sorry the JSON dictionary pattern for translating rich HTML content it not appropriate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #268
Summary
tfilter, enabling emails to be sent in the contact's preferred language automaticallyworkspace_translationstable and CRUD API for managing workspace-wide translation stringsWhat's Included
Backend
ResolveNestedKey,InterpolatePlaceholders,ResolveLocale,MergeTranslationsutility functions;WorkspaceTranslationentity; new fields onTemplateandWorkspaceSettingsTranslationFiltersstruct withTmethod registered onSecureLiquidEngine;RegisterTranslations()methodtranslations(JSONB) anddefault_languagecolumns to templates table; createsworkspace_translationstableWorkspaceTranslationRepositorywith Upsert/GetByLocale/List/DeleteWorkspaceTranslationServicewith auth integration; translation wiring inEmailServiceand broadcastQueueMessageSenderworkspace_translations.upsert,.list,.deleteFrontend
TranslationsPanelcomponent: flat key editor with per-locale columns, search, JSON import/exportCreateTemplateDrawerLanguageSettingscomponent in workspace settingsDependencies
Related PRs
Test plan
make test-unit)tfilter: 6 test cases (simple keys, missing keys, placeholders, contact variables)tsc --noEmit)go build ./cmd/api/)Note
go.modcurrently has areplacedirective for local liquidgo development. Once Notifuse/liquidgo#3 is merged and tagged, updatego.modto point to the new remote version and remove the replace directive.