pywikitools.resourcesbot.write_report#

Module Contents#

Classes#

Color

Generic enumeration.

WriteReport

Write/update status reports for all languages (for translators and translation coordinators).

class pywikitools.resourcesbot.write_report.Color#

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

class pywikitools.resourcesbot.write_report.WriteReport(fortraininglib: pywikitools.fortraininglib.ForTrainingLib, site: pywikibot.site.APISite, *, force_rewrite: bool = False)#

Bases: pywikitools.resourcesbot.post_processing.LanguagePostProcessor

Write/update status reports for all languages (for translators and translation coordinators).

Every language report has a table with the translation status of all worksheets: Which worksheet is translated? Is the translation 100% complete? Is it the same version as the English original? Do we have ODT and PDF files for download? To help interpreting the results, we use colors (green / orange / red) for each cell.

run(self, language_info: pywikitools.resourcesbot.data_structures.LanguageInfo, english_info: pywikitools.resourcesbot.data_structures.LanguageInfo, change_log: pywikitools.resourcesbot.changes.ChangeLog)#

Entry function

save_language_report(self, language_info: pywikitools.resourcesbot.data_structures.LanguageInfo, english_info: pywikitools.resourcesbot.data_structures.LanguageInfo)#

Saving a language report (URL e.g.: https://www.4training.net/4training:German) @param language_info: The language we want to write the report for @param english_info: We need the details of the English original worksheets as well

create_mediawiki(self, language_info: pywikitools.resourcesbot.data_structures.LanguageInfo, english_info: pywikitools.resourcesbot.data_structures.LanguageInfo) str#

Build mediawiki code for the complete report page

create_worksheet_overview(self, language_info: pywikitools.resourcesbot.data_structures.LanguageInfo, english_info: pywikitools.resourcesbot.data_structures.LanguageInfo) str#

Create mediawiki code to display the whole worksheet overview table

Parameters
  • language_info – all information on the language we’re writing this report for

  • english_info – LanguageInfo for English - needed because we need English WorksheetInfos

Returns

string with mediawiki code for a whole paragraph with the complete table

create_worksheet_line(self, language_code: str, en_worksheet: pywikitools.resourcesbot.data_structures.WorksheetInfo, lang_worksheet: Optional[pywikitools.resourcesbot.data_structures.WorksheetInfo]) str#

Create mediawiki code with report for one worksheet (one line of the overview)

Parameters
  • language_code – Which language we’re writing this report line for (we can’t use worksheet_info.language_code because worksheet_info may be None)

  • en_worksheet – WorksheetInfo for the English original

  • lang_worksheet – WorksheetInfo for the translation if it exists, otherwise None

Returns

string with mediawiki code for one line of our table