User:APatro (WMF)/Mark page for translation - Process flow
Glossary
[edit]See - Help:Extension:Translate/Glossary
Please ensure that you are familiar with the following terminology:
- message collection
- message group
- message handle
- message index
- source page
- state
- translatable page
- translatable page source
- translation page
- translation unit
- translation unit identifier
- translation unit marker
- translation unit page
- translation unit source
What happens when
[edit]Page is marked for translation
[edit]SpecialPageTranslation
- Majority of work is done in the function:markForTranslation
.- Identify sections and section markers in the page.
- Saves the content in the source page along with the section markers
- Identify sections that have been marked as fuzzy by the user.
- Delete all the existing sections from the
translate_sections
. - Re-insert the identified sections into the
translate_sections
. - Save the
maxid
and page syntaxversion
intranslate_metadata
. - Add the
tp:mark
revtag
to the page. - Re-cache the Message group definitions -
MessageGroups::singleton()->recache()
to update the list of groups in the cache. - Store the new page section names in the interim cache. This is done to avoid issues caused due to delays caused in updating the message index.
- Push a
TranslationsUpdateJob
to theJobQueue
. Pass it the page title, and all the serialized sections. - Handle priority languages; save that information in the
translate_metadata
table. - Add a manual log entry
- Invalidate the page title cache; update the
page_touched
for the title.
TranslationsUpdateJob
- Create a
MessageUpdateJob
for each unit page in the source language. Eg: Main_Page/1/en, Main_Page/2/en etc. - Run the
MessageUpdateJob
s to update the contents of the translation unit page. - Wait for replication lag.
- Clear the
MessageGroups
process cache. - Clear the
WikiPageMessageGroup
cache which removes the definitions. - Update group stats for the page's
MessageGroup
. - Add
TranslateRenderJob
for all the translation pages including the source language translation page to the job queue. - Add
MessageIndexRebuildJob
to the job queue.
- Create a
TranslateRenderJob
(Multiple based on language codes)- Identify the language code.
- Load the
MessageCollection
with the given group and language code. - Get the translation page text.
- Save / Update the translation page.
During this process no changes are made to the translation unit pages of the non-source translation pages.
Section is translated
[edit]TranslateEditAddons::onSaveComplete
- Check if the content is
TextContent
, and the handle is valid. - Check and mark the translation as fuzzy incase it fails validation
- If it is a non-source language; update the translation status.
- Update the message group state.
- Create
TTMServerMessageUpdateJob
to update the translation memory. - Call
PageTranslationHooks::onSectionSave
- Check if the content is
PageTranslationHooks::onSectionSave
- Ensure that it is NOT FuzzyBot making the translation.
- Ensure that the Title belongs to the
WikiPageMessageGroup
. - Ensure that it is NOT message documentation.
PageTranslationHooks::updateTranslationPage
- Create a
TranslateRenderJob
to update the translation page. - Purge the cache for all the translation pages in order to update the language bar.
- Create a
Jobs in Translate
[edit]This section describes the relevant jobs involved when a page is marked for translation or a section is translated.
TranslationsUpdateJob
[edit]- Creates and runs the
MessageUpdateJob
to update the translation unit pages in the source language. - Regenerates the group stats for the page.
- Create the
TranslateRenderJob
for all the translation pages and add them to the job queue. - Add a
MessageIndexRebuildJob
to the job queue.
Added to the job queue by SpecialPageTranslation
when a page is marked for translation.
MessageUpdateJob
[edit]Updates the translation unit pages with the new translation text.
Added to the job queue by TranslationsUpdateJob
.
TranslateRenderJob
[edit]When a page is marked for translation, TranslateRenderJob
s are created for each existing translation pages. They update the translation pages with the latest content of page that was marked for translation.
When a section is translated, a TranslateRenderJob
is created to update the translation page for the language in which the section was translated.
- Added to the job queue by
PageTranslationHook
when a section is saved. - Added to the job queue by
TranslationsUpdateJob
when a page is marked for translation.
MessageIndexRebuildJob
[edit]Used to rebuild the MessageIndex
with information regarding the latest page marked for translation. De-duplication is in place for this job to ensure that only once instance of this job is present in the job queue at any given time.
Added to the job queue by TranslationsUpdateJob
.
MessageGroupStatesUpdaterJob
[edit]Handles automatic state changes for message groups for a specific language.
Added to the job queue by PageTranslationHook
when a section is saved.