@@ -66,10 +66,33 @@ Different content managers handle the publishing workflow:
6666
6767#### 5. Services (` kitsune/wiki/services.py ` )
6868
69+ ** TranslationQueryBuilder**
70+ - Centralized repository for complex translation discovery queries
71+ - Provides methods to find stale and missing translations
72+ - Implements document-aware routing logic for AI vs HYBRID flows
73+ - Key methods:
74+ - ` get_stale_docs_hybrid() ` : Finds non-archived stale translations in HYBRID locales
75+ - ` get_stale_docs_ai() ` : Finds all stale translations for AI flow (all AI docs + archived HYBRID docs)
76+ - ` get_missing_docs_hybrid() ` : Finds non-archived documents without translations in HYBRID locales
77+ - ` get_missing_docs_ai() ` : Finds documents without translations for AI flow
78+ - ` get_pending_translations() ` : Finds unreviewed translations exceeding grace period
79+ - ` get_obsolete_translations() ` : Finds translations that are no longer useful
80+
81+ ** BaseTranslationService**
82+ - Shared processing logic for translation services
83+ - Handles metadata building and strategy execution
84+ - Uses TranslationQueryBuilder for document discovery
85+
6986** StaleTranslationService**
7087- Identifies outdated translations that need updates
7188- Processes batch updates using appropriate strategies
7289- Configurable via ` STALE_TRANSLATION_THRESHOLD_DAYS ` and ` STALE_TRANSLATION_BATCH_SIZE `
90+ - Method: ` process_stale(limit, strategy) ` - optionally filters by AI or HYBRID strategy
91+
92+ ** MissingTranslationService**
93+ - Creates initial translations for documents without existing translations
94+ - Uses document archive status for smart routing
95+ - Method: ` process_missing(limit, strategy) ` - creates translations for missing docs
7396
7497** HybridTranslationService**
7598- Manages hybrid workflow automation
@@ -84,6 +107,24 @@ The system responds to several trigger events (`TranslationTrigger`):
84107- ` MARK_READY_FOR_L10N ` : Manual request to mark content for translation
85108- ` TRANSLATE ` : Direct translation request
86109- ` STALE_TRANSLATION_UPDATE ` : Periodic updates of outdated content
110+ - ` INITIAL_TRANSLATION ` : Creating new translations for documents without existing translations
111+
112+ ### Document-Aware Routing
113+
114+ The system intelligently routes translations based on document status and target locale:
115+
116+ ** Archived Documents in HYBRID Locales**
117+ - Archived knowledge base articles in HYBRID locales automatically use the AI flow
118+ - This reduces review burden for content that's no longer actively maintained
119+ - Implemented via ` TranslationStrategyFactory.get_method_for_document() `
120+
121+ ** Routing Logic:**
122+ ``` python
123+ if locale in HYBRID_ENABLED_LOCALES and document.is_archived:
124+ return TranslationMethod.AI # Skip human review for archived docs
125+ else :
126+ return get_method_for_locale(locale) # Standard locale-based routing
127+ ```
87128
88129## Configuration
89130
@@ -163,7 +204,18 @@ graph TD
163204python manage.py process_stale_translations --limit 100
164205```
165206
166- Updates outdated translations across all AI/Hybrid enabled locales.
207+ Updates outdated translations across all AI/Hybrid enabled locales. The service automatically routes documents based on their archive status and locale configuration.
208+
209+ ### Create Missing Translations
210+
211+ ``` bash
212+ python manage.py create_missing_translations --limit 50
213+ ```
214+
215+ Creates initial translations for English documents that don't have translations yet. Uses document-aware routing:
216+ - AI locales: translates all documents (archived and non-archived)
217+ - HYBRID locales (non-archived docs): creates translations for human review
218+ - HYBRID locales (archived docs): auto-publishes via AI flow
167219
168220### Publish Pending Translations
169221
0 commit comments