#31384 closed enhancement (fixed)

localize snowflake website

Reported by: emmapeel Owned by: cohosh
Priority: Medium Milestone:
Component: Circumvention/Snowflake Version:
Severity: Normal Keywords: l10n, anti-censorship-roadmap-september
Cc: emmapeel, dcf, arlolra, cohosh, phw, hiro Actual Points: 2.5
Parent ID: Points:
Reviewer: phw Sponsor: Sponsor28

Description

https://snowflake.torproject.org/ should appear at least on our priority 12 languages.

Child Tickets

Change History (26)

comment:1 Changed 15 months ago by emmapeel

The file at https://gitweb.torproject.org/pluggable-transports/snowflake.git/tree/proxy/static/index.html (thanks cohosh) is easily translatable, but i am not sure how users will change from one language to the other.

i could provide a folder with different translations of the index.html page to be loaded as a git submodule, if you want, i.e.:

translations/

index+fr.html
index+de.html
etc

Then, we just need to add a little menu with the translated languages on top.

what do you think?

comment:2 Changed 14 months ago by emmapeel

Status: newneeds_review

the translations of the web interface are available at

https://gitweb.torproject.org/translation.git/log/?h=snowflake-website-indexhtml

i.e. repo https://git.torproject.org/translation.git

branch snowflake-website-indexhtml

Please let me know if you can use them to provide a localized version of the webpage.

comment:3 Changed 14 months ago by gaba

Keywords: anti-censorship-roadmap-october added
Sponsor: Sponsor28

comment:4 Changed 14 months ago by gaba

Keywords: anti-censorship-roadmap-september added; anti-censorship-roadmap-october removed

comment:5 in reply to:  2 ; Changed 14 months ago by dcf

Keywords: snowflake-webextension removed
Status: needs_reviewneeds_information

Replying to emmapeel:

Please let me know if you can use them to provide a localized version of the webpage.

I have some process-related questions.

How do we know which language to use? In comment:2 you mentioned adding a menu to the page. I see such a menu at https://tb-manual.torproject.org/, defaulting(?) to English. Should we also look at the Accept-Language HTTP header (i.e., the user's in-browser configured language)? Do other Tor Project pages do that?

What is the process for handling revisions to the source text? Will the translation.git repository periodically get a revised index.html, then make changes in that repository? Then we import those changes back into snowflake.git? Is there some way to notify each group about when updates are ready from the other side?

comment:6 in reply to:  5 Changed 14 months ago by cohosh

Replying to dcf:

Replying to emmapeel:

Please let me know if you can use them to provide a localized version of the webpage.

I have some process-related questions.

How do we know which language to use? In comment:2 you mentioned adding a menu to the page. I see such a menu at https://tb-manual.torproject.org/, defaulting(?) to English. Should we also look at the Accept-Language HTTP header (i.e., the user's in-browser configured language)? Do other Tor Project pages do that?

Looks like arlo's most recently changes in #30310 use the navigator.language property to set the translation and default to English if none exist. See https://github.com/keroserene/snowflake/commit/da21c6710cd871d931f2eea2a185b78b1907d3db#diff-c371ea9d4448f98b3fda1dfca95c925eR93

comment:7 Changed 14 months ago by arlolra

Parent ID: #30310

comment:8 in reply to:  5 Changed 14 months ago by emmapeel

Replying to dcf:

I have some process-related questions.

How do we know which language to use? In comment:2 you mentioned adding a menu to the page. I see such a menu at https://tb-manual.torproject.org/, defaulting(?) to English. Should we also look at the Accept-Language HTTP header (i.e., the user's in-browser configured language)? Do other Tor Project pages do that?

The ideal will be to allow users to change it by hand, as our own browser allows to hide your language and many people browse the web in English because of fingerprinting, or sometimes are using public computers, etc, so it is unlikely that they will have the proper language configured.

What is the process for handling revisions to the source text? Will the translation.git repository periodically get a revised index.html, then make changes in that repository? Then we import those changes back into snowflake.git? Is there some way to notify each group about when updates are ready from the other side?

I can hook the translation system to the repository at https://gitweb.torproject.org/pluggable-transports/snowflake.git/plain/proxy/static/index.html, so the changes on the file will be reflected some hours later on the translation platform (i have done that already with messages.json). transifex will pull the source files twice a day I think.

It would be great if somebody from the team can join transifex, as sometimes there are comments translators do on the source strings that would be nice if you review.

From inside of transifex you could see if the file is translated and reviewed, the comments, etc.

I can help you decide on the languages that are ready when you approach release.

We could also make a call for translations to speed up the process, currently many languages are translated but not reviewed.

Also, if you have friends that want to review a specific language before publishing, send them to me, as we need trusted reviewers for many languages.

comment:9 Changed 13 months ago by cohosh

Owner: set to cohosh
Status: needs_informationassigned

I've started working on this, I think having full index.html files will be difficult to deal with and is different from how we are doing things the webextension and also different from how bridges.tp.o and gettor.tp.o work.

I've started expanding messages.json with the website text but if there's a better way to do this, let me know :)

comment:10 Changed 13 months ago by cohosh

It won't work right now because I need to hook up the .js fill function, but this is an idea of what it looks like: https://github.com/cohosh/snowflake/tree/ticket31384

comment:11 Changed 13 months ago by cohosh

Cc: hiro added

Okay I've been thinking more about how to structure this. https://snowflake.torproject.org is structured a bit differently from other anti-censorship tp.o sites and therefore does localization differently.

For example, bridgeDB and gettor both use python to render the site and python libraries for localization. The snowflake webextension uses messages.json for each string in the webextension.

It looks like right now the translation repository for this website is set up to translate the index.html file entirely: https://gitweb.torproject.org/translation.git/tree/?h=snowflake-website-indexhtml_completed

Is this how we want to do this? I'm curious about how the rest of tp.o handles localization here. Also, it looks like the index.html file being used by transifex doesn't quite match the index.html file in proxy/static/.

Does it make incremental changes to index.html harder to update?

comment:12 Changed 13 months ago by cohosh

Status: assignedneeds_information

comment:13 in reply to:  11 Changed 13 months ago by dcf

Replying to cohosh:

It looks like right now the translation repository for this website is set up to translate the index.html file entirely: https://gitweb.torproject.org/translation.git/tree/?h=snowflake-website-indexhtml_completed

Is this how we want to do this? I'm curious about how the rest of tp.o handles localization here. Also, it looks like the index.html file being used by transifex doesn't quite match the index.html file in proxy/static/.

That's partly my fault, because I did some HTML and CSS refactoring changes not knowing that the translation repository existed.

I can see how merging changes like that will be annoying to translators. But if we don't anticipate index.html being changed that often, I'm fine with translating the whole file as a "worse-is-better" approach.

comment:14 in reply to:  11 Changed 13 months ago by emmapeel

Replying to cohosh:

Is this how we want to do this? I'm curious about how the rest of tp.o handles localization here.

  • Some applications handle it with po4a and provide me of a .pot file and i give them the different language .po files
  • the resources used by TBB are mozilla localization dtd and properties files
  • the index file i added directly using the transifex framework because it was an easy html file... maybe that is not the case anymore?
  • some markdown files are translated directly

Also, it looks like the index.html file being used by transifex doesn't quite match the index.html file in proxy/static/.

This was because i didnt have it configured to pull daily from it. This is fixed now, and the file has been refreshed. Transifex will look it up twice a day and update it automatically.

comment:15 in reply to:  9 Changed 13 months ago by emmapeel

Replying to cohosh:

I've started working on this, I think having full index.html files will be difficult to deal with and is different from how we are doing things the webextension and also different from how bridges.tp.o and gettor.tp.o work.

I've started expanding messages.json with the website text but if there's a better way to do this, let me know :)

Oh yes, json files are also a good match and they are better than the html straight.

Sorry I just read this comment now, but yeah that would be much better

comment:16 in reply to:  10 Changed 13 months ago by dcf

Replying to cohosh:

It won't work right now because I need to hook up the .js fill function, but this is an idea of what it looks like: https://github.com/cohosh/snowflake/tree/ticket31384

If you want to do it this way, I would suggest not doing

<h2>__MSG_browser__</h2>

but instead something like

<h2 data-msgid="__MSG_browser__">Browser</h2>

That way, a failure of the fill function, or a missing translation, will at least show English text rather than a raw message identifier. The data- attribute prefix can be used to attach arbitrary information to HTML elements.

          __MSG_either__<a href="https://trac.torproject.org/projects/tor/register">__MSG_createAccount__</a> __MSG_or__ <a href="https://trac.torproject.org/projects/tor/login">log in</a>
          __MSG_usingShared__<b>cypherpunks</b> __MSG_withPassword__ <b>writecode</b>.</li>

I'm guessing that this kind of structure will be difficult to translate because the translator cannot change the order of the <a></a> and <b></b> fragments. It may be better to allow HTML in the replacement strings.

comment:17 Changed 13 months ago by cohosh

Status: needs_informationaccepted

Okay here's my current progress on this ticket: https://github.com/cohosh/snowflake/compare/website-translation

I switched to using messages.json and took dcf's advice of using the data-msgid attribute to set the key for the localized strings.

Tomorrow I'll add a dropdown language switcher as in #26543, and see if we should do something different for rtl languages.

comment:18 Changed 13 months ago by cohosh

Status: acceptedneeds_review

Done implementing this language switcher. Here's a pull request: https://github.com/cohosh/snowflake/pull/9

Note that because we're using the same messages.json file as the webextension for the translations, we won't need two different translation repositories.

comment:19 Changed 13 months ago by cohosh

Actual Points: 2

Updating with points so far

comment:20 Changed 12 months ago by phw

Reviewer: phw
Status: needs_reviewneeds_revision

I added a handful of comments to the pull request: https://github.com/cohosh/snowflake/pull/9

comment:21 Changed 12 months ago by cohosh

Status: needs_revisionneeds_review

Thanks! Added some fixes.

comment:22 Changed 12 months ago by cohosh

Actual Points: 22.5

Updating time sent on this ticket.

comment:23 in reply to:  21 Changed 12 months ago by phw

Status: needs_reviewneeds_revision

Replying to cohosh:

Thanks! Added some fixes.


The fixes look great. I only have one comment left.

comment:24 Changed 12 months ago by cohosh

I replied to your comment, how does it look now?

comment:25 in reply to:  24 Changed 12 months ago by phw

Status: needs_revisionmerge_ready

Replying to cohosh:

I replied to your comment, how does it look now?


As we just discussed on IRC, I had a CORS error in my console because I was browsing the page locally:

Fetch API cannot load file:///home/phw/rcs/snowflake/proxy/build/_locales/de/messages.json. URL scheme must be "http" or "https" for CORS request.

One can temporarily work around this by disabling CORS. In Firefox, one can create a new testing profile and set security.fileuri.strict_origin_policy to false. Once I disabled it, my default language shows up in the language switcher.

comment:26 Changed 12 months ago by cohosh

Resolution: fixed
Status: merge_readyclosed

Merged at https://gitweb.torproject.org/pluggable-transports/snowflake.git/commit/?id=da8b98d09089e32d53573a1cabcb450aa290b4c8

Let's wait to update the website until we get some translations... merging this should update the files at Transifex but all the text will be English until we start translating the strings.

Note: See TracTickets for help on using tickets.