lookit / lookit-api

Codebase for Lookit v2 and Experimenter v2. Includes an API. Docs: http://lookit.readthedocs.io/
https://lookit.mit.edu/
MIT License
10 stars 18 forks source link

Fix static word order in translated text #1373

Closed becky-gilbert closed 5 months ago

becky-gilbert commented 5 months ago

TL;DR

We need to fix instances where our text strings assume a static order between translated text segments and variables.

Summary

There is at least one text string on the site that restricts the word order of the sentence because it concatenates a portion of the sentence with text that comes from a variable, and doesn't allow the translation file to move the variable elsewhere in the sentence.

trans "This study is conducted by " + study contact info

The above text string is not compatible with Hungarian (and possibly other languages) because the study contact info word order is not the last part of the sentence.

Thanks to @NevenaKlo for reporting this. We should work with MBAH to identify any other text strings that could be causing the same problem (whether in Hungarian or another language) and fix these at the same time.

Other relevant issues

See https://github.com/lookit/lookit-api/issues/840

becky-gilbert commented 5 months ago

Two more examples:

{% trans "Add child profile to " %} + {% trans preview/participate %}

{% trans "Complete demographic survey to " %} + {% trans preview/participate %}

Explanation of the problem from @NevenaKlo:

the preposition 'to' in Hungarian is to be added as a suffix after nouns. In these cases, 'to' would be added to the option they select.

If I understand correctly, maybe in the two above cases, the Hungarian "to" could be added to the translation strings for "preview" and "participate". However the "preview"/"participate" strings are also used for translating the button when it says "Preview now!" or "Participate now!", so if the "to" doesn't belong in that case then we'll have to change it on our end anyway.

My proposed solution for all three cases is to turn each one into a translation of the entire sentence with a variable that can be moved anywhere in the string. This way we're not translating parts of sentences and concatenating them together, which is causing these word order problems. So it would look like this:

"This study is conducted by {{ contact }}."

Which I think can be translated as:

"Ez egy {{ contact }} által végzett tanulmány."

Changing this means we will also have to update all of the existing translation files. @NevenaKlo @rhodricusack would you (or anyone else on your team) be able to help us update/review this change in all of the other translation files?

NevenaKlo commented 5 months ago

I can revise the files for Brazilian Portuguese and Italian, and maybe Hebrew.

Now that I have seen what the examples are followed by (i.e., 'participate/preview'), I think those sentences are not problematic for Hungarian. They would be problematic if there was a noun after, to which the preposition 'to' is added as a suffix. But if there is a verb, the sentence should be translated without problems.

However, the issue remains for sentences such as the latter you mentioned ("This study is conducted by..."), and concerns other languages as well (for example, Basque), so your suggestion is very helpful!

becky-gilbert commented 5 months ago

I can revise the files for Brazilian Portuguese and Italian, and maybe Hebrew.

Wonderful, thank you! I'll let you know when the updated .po files for these languages are ready for you to look at.

Now that I have seen what the examples are followed by (i.e., 'participate/preview'), I think those sentences are not problematic for Hungarian. They would be problematic if there was a noun after, to which the preposition 'to' is added as a suffix. But if there is a verb, the sentence should be translated without problems.

Ok thanks. So just to clarify: I think you're saying that we can leave these ones as they are:

{% trans "Add child profile to " %} + {% trans preview/participate %}

{% trans "Complete demographic survey to " %} + {% trans preview/participate %}

And we should change "This study is conducted by " so that it incorporates the contact information as an argument that can be moved anywhere in the sentence, like this:

"This study is conducted by {{ contact }}."

Please let me know if that's right. And it would be super helpful if you could double-check for any other similar instances so that we can be sure to change them at the same time.

Also, do you know if you have an up-to-date .po file to use as a basis for your new lookit-api translations? If not I can provide one. It should be generated using our most recent version of the develop branch. (I noticed that some of our other translation files are really out-of-date!).

NevenaKlo commented 5 months ago

My translator confirmed that {% trans preview/participate %} can be simply added at the end of the two sentences! In "This study is contacted by", I can confirm that the contact information should be a movable argument, as it needs to appear earlier in the sentence.

In the Hungarian translation, these were the only three sentences which were flagged to me by the translator, everything else was fine.

The .po file I was using so far is based on the pt-br version which I found in this repository, as that was the first language I worked on. That is the file I have shared with the Hungarian translator, so if there is a new updated file it would be great if you can share it with me!