GenderDysphoria / GenderDysphoria.fyi

Site code
Other
224 stars 63 forks source link

Tweet translation #64

Closed gjvnq closed 2 years ago

gjvnq commented 2 years ago

I figured out a pretty cool way to allow for translations for the tweets: I set up another JSON file (twitter-i18n.json) that contains the translations and adapted the JS files to properly consider this new data source.

See the code I made in the following two commits:

https://github.com/gjvnq/GenderDysphoria.fyi/commit/ef0511fb3c34a954209fd822e7922923401adb49 https://github.com/gjvnq/GenderDysphoria.fyi/commit/b5a7b540d2f23e00f6b86344efa02b0eb451a9ff

Twipped commented 2 years ago

So a couple notes on the way this is built... twitter-backup exists to be a raw archive of the tweet data as it arrived from the API. The only time I ever make modifications to it manually is if a tweet is deleted and I want to fix some bad urls. So that's not the right place to be putting language updates. Secondly, my goal with the structure is to have everything language related exist inside that language's directory, so the tweet translations for pt need to exist inside public/pt.

To that end, the approach I was planning to do was have a twitter.json file which be merged onto the twitter-cache data file for that language.

What I think may need to happen is create an actual tweet helper instead of just importing a template. Then the helper can handle both the loading of the tweet info and the language processing, and I can eliminate the tweets metadata import need.

gjvnq commented 2 years ago

Closed because of #96 was merged.