Closed JonasGessner closed 6 years ago
Then it might be best to deprecate approach A and eventually remove support for it? I would try to keep the format as clean and simple and unambiguous as possible. Only supporting option B here and getting rid of all the optional attributes would already be a big improvement.
The phyphox file format allows for two different approaches to handle translations:
A. The file contains strings in a main language and those are translated in translations blocks. The root element should define the locale of the strings outside of the translation block.
B. The file contains placeholder strings that are never shown to the user. In this case, there must be an English translation in the translations block as fallback and the root element may not define a locale.
Approach A is used in most cases as it is the more natural one, especially for external users who create their own experiment. Most users do not create experiments with multiple languages, so they can simply set up an experiment without a translation block. A translation can still be added later without rewriting the whole file.
However, approach B is the superior one because of its smaller size and exact matching of strings. The size starts to play a role when more and more languages are added as in approach A long strings are repeated in each translation block. For this reason, we should actually start to convert more of the stock phyphox experiment to format B as more languages are added. The problem of exact matches is best explained in an example:
An applause meter experiment is created in English and defines a graph with an axis "Score". Also, there is a value element with the same label:
The German translator decides to translate "Score" as "Punktzahl", but finds that "Punktzahl" is too long for the y axis (it probably is not, but you can imagine that there are exmaples that are longer). So, he would prefer to translate the value element as "Punktzahl" and the axis label as "Punkte". In approach B, both entries can have different placeholders with different translations in German that remain the same in English, but in approach A this can only be done if the English translator also introduces different translations.
So, to finally answer the issue report: The light experiment currently is the only one in format B. In this format, the main file does not contain any human readable strings that are ever shown and a translation block is always used. So, there is no need to set a title in the main block as long as there is an English translation that has its own title block. The same applies to description and category. Actually, as the number of translations increase and as there will be cases of translators who want to translate the same text differently (for size reasons, because of grammar or when different context requires different words in one language but not in the other one), we will eventually need to change more experiments into format B. Also, the editor should be changed to generate this format as experiments need to be small for the new QR code feature. Still we need to allow format A as this is much more readable and easier to use for users who create experiments only for their own need in a single language.