translation

package
v1.1.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package translation provides AWS Translate integration with caching for multilingual content support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LanguageInfo

type LanguageInfo struct {
	Code string
	Name string
}

LanguageInfo contains information about a language

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides translation functionality using AWS Translate

func NewService

func NewService(ctx context.Context, cfg *lesserconfig.Config, store storagecore.RepositoryStorage, logger *zap.Logger, cacheEnabled bool) (*Service, error)

NewService creates a new translation service.

func (*Service) DetectLanguage

func (s *Service) DetectLanguage(ctx context.Context, text string) (string, float32, error)

DetectLanguage detects the language of the given text

func (*Service) GetSupportedLanguages

func (s *Service) GetSupportedLanguages(ctx context.Context) ([]LanguageInfo, error)

GetSupportedLanguages returns the list of supported language pairs

func (*Service) TranslateHTML

func (s *Service) TranslateHTML(ctx context.Context, html, sourceLang, targetLang string) (string, string, error)

TranslateHTML translates HTML content while preserving formatting

func (*Service) TranslateText

func (s *Service) TranslateText(ctx context.Context, text, sourceLang, targetLang string) (string, string, error)

TranslateText translates text from source language to target language

type TranslationCache

type TranslationCache struct {
	TranslatedText   string
	DetectedLanguage string
	CachedAt         time.Time
}

TranslationCache provides caching for translations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL