Closed pixelzoom closed 1 year ago
Here's the English dialog:
@DianaTavares said:
I thought that I could change the link in the Translation Tool, but no, the link is not a string that can be changed.
Links are typically not translatable, it's a security issue.
Is possible that the link to the java sims go to the same local that the HTML5?
phet.chipper.queryParameters.locale
gives us runtime locale of the sim. So I think the general form of the link could be changed to this, but I'm not 100% certain:
https://phet.colorado.edu/sims/html/molecule-polarity/latest/molecule-polarity_${phet.chipper.queryParameters.locale}.html
EDIT: That general form does appear to work, tested for several locales including 'en' and 'es'.
@arouinfar thoughts? Should we spend time on this?
Ah... But since locale can be changed dynamically, the link will also need to change dynamically. So something like this (untested):
const linkStringProperty = new DerivedProperty( [ localeProperty ], locale =>
`https://phet.colorado.edu/sims/html/molecule-polarity/latest/molecule-polarity_${locale}.html`
);
But wait, there's more complication...
https://phet.colorado.edu/sims/html/molecule-polarity/latest/molecule-polarity_${locale}.html
is the link to the HTML5 version, not the legacy version.
When I go to the legacy page at https://phet.colorado.edu/en/simulation/legacy/molecule-polarity, there's no a specific URL per locale. You have to select the Translations tab, then decided whether to press the CheerpJ or Java button.
So yes, I can figure out what the locale is, and I can even make that dynamic. But I don't know what the URL should be.
Oooo... Another problem. Getting the locale for the HTML5 version does not mean that there's a Java version for that locale. So even if we knew the general form of the link to a translated Java version, it would be unsafe to send them there, because it may not exist.
@DianaTavares suggested:
... probably add to the dialog text in the HTML5 sim to look in the translations for the correct local.
That's certainly easy to do, but... Anything we add to the dialog text will need to be translated. That means notifying translators, waiting for translation to be done, etc.
How about just sending them to the legacy webpage for the locale-specific website? General form (note the ${locale}
):
https://phet.colorado.edu/${locale}/simulations/molecule-polarity/translations
But is there guaranteed to be a locale-specific website (and legacy webpage!) for the HTML5 sim's locale? For example if my sim's locale was "foo", can I count on there being a "foo" translation of the website? For "foo", the URL would be
https://phet.colorado.edu/foo/simulations/molecule-polarity/translations
, and that results in:
I'm confused, seeing some strange behavior with the website:
So there appears to be no direct link to the legacy translations.
@mattpen replied in Slack#dev-public:
Try replacing /legacy/ with /deprecated/ https://phet.colorado.edu/en/simulations/deprecated/molecule-polarity/translations
I see now that clicking the translation tab even on the deprecated page will remove that path from the URL, I’ll open an issue to fix that
This is intentionally not published publicly anywhere
General form https://phet.colorado.edu/${locale}/simulations/deprecated/molecule-polarity/translations
does indeed get me to the Translations page for ${locale}
. But if the HTML5 sim is running in a local for which there is no legacy page, then I get a 404 error. So I think there’s a fundamental problem with linking directly to a locale-specific legacy page.
The link on the TAB on Molecule Polarity's page is broken, but this URL should work: https://phet.colorado.edu/en/simulations/legacy/molecule-polarity/translations
Unfortunately, the list of locales supported by the website is never going to be the same as the list of locales for molecule-polarity, so for that link to be localized we'll need to do some kind of checking for support. We could somehow build in a list of website supported locales, but that would mean we need to maintenance release all sims every time a locale is added to the website. We could also do an http check for https://phet.colorado.edu/{{locale}}/simulations/legacy/molecule-polarity/translations, then if we get 200 OK show that link and if we get a 404 show the English link. These both sound like poor solutions.
So... Because the HTML5 locale may not exist for the legacy version, the only safe thing to do is send them to the English legacy page. If we add something to the dialog that tells the user to "click Translations", that's not going to be very effective -- the English page will be showing "Translations", and the dialog text will be translated.
So after acknowledging that the current solution is not friendly for non-English users... My recommendation is to change nothing. This dialog was supposed to be temporary, until the Real Molecules screen was completed. Sadly it's been this way since June 2017. The effort would be better spent completing that screen.
@arouinfar thoughts?
@mattpen is right. The website (and therefore simulation page) will exist in far fewer languages than either version of the sim ever will. Using something like {{locale}} in the path isn't going to work without an elaborate set of fallbacks, and I don't think it's worth the time.
We could instead link to https://phet.colorado.edu/en/simulations/legacy/molecule-polarity/translations, which seems like an easy change. It has basically no effect on the English-speaking user and it would save a click for people who would need to use a translated version of the sim. @pixelzoom can you update the link?
Link updated, see screenshot below.
@arouinfar @DianaTavares please review in master. Last one to review please close if it looks OK.
Looks good to me, thanks @pixelzoom!
Looks good! Thanks!!
@DianaTavares reported in Slack#general: