User:APatro (WMF)/Mark page for translation - Process flow

From mediawiki.org

Glossary[edit]

See - Help:Extension:Translate/Glossary

Please ensure that you are familiar with the following terminology:

  1. message collection
  2. message group
  3. message handle
  4. message index
  5. source page
  6. state
  7. translatable page
  8. translatable page source
  9. translation page
  10. translation unit
  11. translation unit identifier
  12. translation unit marker
  13. translation unit page
  14. translation unit source

What happens when[edit]

Page is marked for translation[edit]

Page is marked for translation
  1. SpecialPageTranslation - Majority of work is done in the function: markForTranslation.
    1. Identify sections and section markers in the page.
    2. Saves the content in the source page along with the section markers
    3. Identify sections that have been marked as fuzzy by the user.
    4. Delete all the existing sections from the translate_sections.
    5. Re-insert the identified sections into the translate_sections.
    6. Save the maxid and page syntax version in translate_metadata.
    7. Add the tp:mark revtag to the page.
    8. Re-cache the Message group definitions - MessageGroups::singleton()->recache() to update the list of groups in the cache.
    9. 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.
    10. Push a TranslationsUpdateJob to the JobQueue. Pass it the page title, and all the serialized sections.
    11. Handle priority languages; save that information in the translate_metadata table.
    12. Add a manual log entry
    13. Invalidate the page title cache; update the page_touched for the title.
  2. TranslationsUpdateJob
    1. Create a MessageUpdateJob for each unit page in the source language. Eg: Main_Page/1/en, Main_Page/2/en etc.
    2. Run the MessageUpdateJobs to update the contents of the translation unit page.
    3. Wait for replication lag.
    4. Clear the MessageGroups process cache.
    5. Clear the WikiPageMessageGroup cache which removes the definitions.
    6. Update group stats for the page's MessageGroup.
    7. Add TranslateRenderJob for all the translation pages including the source language translation page to the job queue.
    8. Add MessageIndexRebuildJob to the job queue.
  3. TranslateRenderJob (Multiple based on language codes)
    1. Identify the language code.
    2. Load the MessageCollection with the given group and language code.
    3. Get the translation page text.
    4. 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]

  1. TranslateEditAddons::onSaveComplete
    1. Check if the content is TextContent, and the handle is valid.
    2. Check and mark the translation as fuzzy incase it fails validation
    3. If it is a non-source language; update the translation status.
    4. Update the message group state.
    5. Create TTMServerMessageUpdateJob to update the translation memory.
    6. Call PageTranslationHooks::onSectionSave
  2. PageTranslationHooks::onSectionSave
    1. Ensure that it is NOT FuzzyBot making the translation.
    2. Ensure that the Title belongs to the WikiPageMessageGroup.
    3. Ensure that it is NOT message documentation.
  3. PageTranslationHooks::updateTranslationPage
    1. Create a TranslateRenderJob to update the translation page.
    2. Purge the cache for all the translation pages in order to update the language bar.

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]

  1. Creates and runs the MessageUpdateJob to update the translation unit pages in the source language.
  2. Regenerates the group stats for the page.
  3. Create the TranslateRenderJob for all the translation pages and add them to the job queue.
  4. 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, TranslateRenderJobs 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.