Localization of Compiler Diagnostic Messages

Since GSoC is coming to an end here's a recap on what I did so far.

Done

  1. In #32483 Refactor DiagnosticEngine to use YAML files, I Introduced localization support for diagnostics via file-per-language store in YAML format. And added a LocalizationFormat interface and its implementation YAMLLocalizationProducer.
  2. In #32630 Create frontend flags for localization, I created frontend flags for localization and added tests to make sure everything is working.
  3. In #32698, #33464, and #33523, I created an en.yaml file that has all of diagnostic messages on the agreed-upon format.
  4. In #33022 Create a serialized format for Localized Diagnostics, I created a serialized format for Localized Diagnostics and created a tool for converting the diagnostics files from .yaml to .db
  5. In #33316 Ignore diagnostic IDs that are available in YAML and not in .def, I modified ScalarEnumerationTraits to handle diagnostic IDs that are available in YAML and not in .def.
  6. In #33337 Make the serialization tool print the removed diagnostics, I created a vector that will keep track of the diagnostic IDs that got removed from .def and still available in YAML. Then I made the swift-serialize-diagnostics tool print out all of the removed diagnostic IDs.
  7. In #33502 Refactor diagnosticStringFor to return StringRef, I refactored the DiagnosticEngine::diagnosticStringFor to return a StringRef.

Ongoing

To Do

As of August 27th, 2020, the remaining work is:

  • Add documentation for localization in docs/Diagnostics
  • Create a pruning tool, to report and remove diagnostics that are in .def but not in YAML.
  • Create a linter for YAML files.
  • Make changes in LLVM::YAMLParser to add support for multiline string folding.

At the end of GSoC, I really wanted to thank you all for your help and guidance throughout the past 4 months. My technical and communication skills improved exponentially, thanks again!

20 Likes