Description
We have started generating OpenAPI specifications for the MediaWiki REST API. These specs will be used to streamline documentation management by reducing the dependency on humans to manually update the documentation when code changes occur. Utilizing industry standard OpenAPI definitions also unlocks new developer experiences (eg: SwaggerUI interactive documentation portal).
In addition to spec generation making it easier for API publishers to manage their APIs, we would also like to make the APIs themselves more accessible to wider international audiences. Wikimedia has robust translation tooling, powered by the TranslateWiki community. Leveraging these workflows and community support will allow us to automate our translation processes and allow developers to read the documentation in the default language of their project.
Problem Statement
Language accessibility is a key pillar of the Wikimedia mission, yet Swagger UI does not natively support client-side language translation. We need a custom solution as part of our OpenAPI spec generation that will allow us to perform automated content translation as part of spec generation. This solution must also be scalable and approachable for API publishers both in and outside of the foundation, including those who extend MediaWiki beyond its core capabilities.
Conditions of acceptance
- Define a hydration mechanism and definition convention for representing translation keys in the OpenAPI specs and JSON schemas.
- Experiment with creating a utility that will generate and inject translation keys automatically as part of the backend spec generation.
- Insert translation keys into and for all relevant specs.
- Launch Special:RESTSandbox onto at least 5 project wikis.
- Socialize our work to broader Wikimedia teams, so they can follow a similar pattern for translation if desired.
Out of scope
Although SwaggerUI is an open source project that we could contribute language support back to, we decided to tackle the Wikimedia use cases first. We may still consider contributing language support more directly through an open source library and/or direct contributions to the Swagger UI project. At minimum, we will highlight the work through tech announcements, and possibly a white paper that can be referenced outside of Wikimedia as an option for automated translation.