Translating phosphor-webui [GUI accessibility]
The GUI design team talked about an attempt to translate the web GUI during the OpenBMC Community Call held on 12/17/2018. Here are my notes of that conversation together with my comments.
An attempt was made to translate the phosphor-webui[1] web application from English into German, Chinese, and other languages. This application consists of HTML, CSS, and Javascript code. The HTML contains English phrases which need to be translated. The JavaScript code also likely contains English phrases which would need to be translated.
The approach was to copy and modify the English HTML files, one set for each target language. For example, bmc-reboot-controller.html[2] (but I didn't record which files were shown during the call). To use the translated version, simply replace the English version with the translated version in your OpenBMC image, and your browser will show the translated version.
Performing the translation was difficult because the English sentences were built from phrases with replacement text in the middle of the sentence. For example, in the sentence, "The processor temperature of 60 degrees is over the limit of 58", can built from HTML like:
<p>The processor temperature of</p><script>...get the
temp...</script><p>degrees is over the limit.</p>.
This presents a problem for translation centers who typically receive each phrase separately and may not have visibility to the entire sentence.
One might think you could simply re-arrange the HTML elements, including the replacement fields, into the sequence you need, but translation centers are not typically set up for that. Besides that, we don't want to trust them messing with our HTML files: that is not their expertise.
The problem becomes impossible to translate correctly when the word order must be changed (which happens regularly for German) such that the replacement text (e.g., 58 and 60 in the example above) must be rearranged. A translation center would reject this and create an issue for the web developer to fix this problem. Hence the recommendation (requirement?) is to always keep entire sentences together and never build them up from phrases.
We discussed using the AngularJS translation framework.
There were some problems with the way the translated text appeared in the web browser window. Some of the translated text was much longer than the English versions; and some of these were clipped instead of flowed. These problems are being addressed by fixing the HTML and CSS code.
We talked about other things that may require translation.
- Translated Redfish schemas[3] for example described by DSP8011.
Redfish schemas are JSON files served by the BMCWeb HTTP server which contain English descriptions of the Redfish APIs. In BMCWeb, they are stored here [4].
- Are the sensor names supposed to be translated or not?
- Do we need to translate any phrases in interfaces like the REST APIs
(Redfish and phosphor-rest), ipmitool, openbmc-tool, and ssh? The thinking was that these are not good candidates for translation.
The decision to translate is driven by balancing the cost of translation and preparing for translation (which can be high in terms of developer effort and $$) compared to the benefit of the project being usable by a wider international audience.
[1]: https://github.com/openbmc/phosphor-webui/blob/master/README.md
[2]: https://github.com/openbmc/phosphor-webui/blob/master/app/server-control/controllers/bmc-reboot-controller.html
[3]: https://www.dmtf.org/standards/redfish
[4]: https://github.com/openbmc/bmcweb/tree/master/static/redfish/v1/JsonSchemas
Quoted 8 lines
Performing the translation was difficult because the English sentences were built from phrases with replacement text in the middle of the sentence. For example, in the sentence, "The processor temperature of
60 degrees is over the limit of 58", can built from HTML like:
<p>The processor temperature of</p><script>...get the
temp...</script><p>degrees is over the limit.</p>.
This exact problem is already covered by the angular translate module. They dedicate a whole page to it in their documentation:
https://angular-translate.github.io/docs/#/guide/06_variable-replacement
Quoted 8 lines
We discussed using the AngularJS translation framework.
There were some problems with the way the translated text appeared in the web browser window. Some of the translated text was much longer than the English versions; and some of these were clipped instead of flowed. These problems are being addressed by fixing the HTML and CSS code.
Sounds good to me. I'm interested in how some of the internals will work, but so long as we're following anular-translate best practices, I don't think we'll have a problem.