feat(api): proxy Translation Memory over bat.sock

This commit is contained in:
2026-09-06 22:50:59 +08:00
parent 7d6389806b
commit e373e3fd32
9 changed files with 848 additions and 42 deletions
+21
View File
@@ -83,6 +83,15 @@ type TranslationBackend interface {
TranslationProofread(ctx context.Context) (json.RawMessage, error)
}
// TranslationMemoryBackend exposes the Rust-owned Translation Memory query and
// explicit confirmation operations. Go forwards typed requests and responses
// but never opens or mutates the TM database itself.
type TranslationMemoryBackend interface {
TranslationMemorySummary(ctx context.Context, params backendrpc.TranslationMemorySummaryParams) (*backendrpc.TranslationMemorySummaryReport, error)
TranslationMemoryQuery(ctx context.Context, params backendrpc.TranslationMemoryQueryParams) (*backendrpc.TranslationMemoryQueryReport, error)
TranslationMemoryConfirm(ctx context.Context, params backendrpc.TranslationMemoryConfirmParams) (*backendrpc.TranslationMemoryConfirmReport, error)
}
// LocalizedBackend exposes localized release status and the explicit
// publish/rollback controls used by the authenticated dashboard.
type LocalizedBackend interface {
@@ -182,6 +191,18 @@ func (r RPCClient) TranslationProofread(ctx context.Context) (json.RawMessage, e
return r.Client.TranslationProofread(ctx)
}
func (r RPCClient) TranslationMemorySummary(ctx context.Context, params backendrpc.TranslationMemorySummaryParams) (*backendrpc.TranslationMemorySummaryReport, error) {
return r.Client.TranslationMemorySummary(ctx, params)
}
func (r RPCClient) TranslationMemoryQuery(ctx context.Context, params backendrpc.TranslationMemoryQueryParams) (*backendrpc.TranslationMemoryQueryReport, error) {
return r.Client.TranslationMemoryQuery(ctx, params)
}
func (r RPCClient) TranslationMemoryConfirm(ctx context.Context, params backendrpc.TranslationMemoryConfirmParams) (*backendrpc.TranslationMemoryConfirmReport, error) {
return r.Client.TranslationMemoryConfirm(ctx, params)
}
func (r RPCClient) LocalizedStatus(ctx context.Context) (json.RawMessage, error) {
return r.Client.LocalizedStatus(ctx)
}