ruffle-rs.github.io icon indicating copy to clipboard operation
ruffle-rs.github.io copied to clipboard

i18n: Translate the website (excluding blogs)

Open danielhjacobs opened this issue 1 year ago • 7 comments

Fixes #110

https://github.com/user-attachments/assets/6a153707-1617-4187-ba48-238cb537e0c1

danielhjacobs avatar Nov 13 '24 18:11 danielhjacobs

https://github.com/martinkr/next-export-i18n/issues/78

danielhjacobs avatar Nov 13 '24 21:11 danielhjacobs

Switched to my own logic for translations.

danielhjacobs avatar Nov 14 '24 20:11 danielhjacobs

Going to mark this PR ready for review. The only untranslated content are blogs 2-5, and they can be translated later if we decide translating blogs is something we want to do. Due to the logic of the code, blogs without {{...}} strings remain untranslated. I did add translations for the blog titles for blogs 2 to 5. Even if I didn't, the translation function would look for the title as a key in the JSON file, not find it, and fall back to the title itself.

danielhjacobs avatar Nov 16 '24 05:11 danielhjacobs

https://github.com/ruffle-rs/ruffle-rs.github.io/blob/253b15cf54fd28b7ec3600fda94b4330fa1b6625/src/i18n/translations.en.json will need to be added to Crowdin.

danielhjacobs avatar Nov 16 '24 05:11 danielhjacobs

Do you think it would be possible to keep the original (English) text in the sources?

The translations could still be looked up using some sort of ID (potentially auto-generated, or manually disambiguated where necessary), you would just have to do a "reverse lookup" first to get the ID.

Similar to how it works in Qt: https://doc.qt.io/qt-5/i18n-source-translation.html#using-tr-for-all-literal-text

torokati44 avatar Dec 30 '24 18:12 torokati44

The reason I think this would be preferred here is that the website is "text first, with some markup and logic sprinkled in", vs. the main Rust code, where it's "code first, which happens to present some text from time to time".

torokati44 avatar Dec 30 '24 18:12 torokati44

Do you think it would be possible to keep the original (English) text in the sources?

The translations could still be looked up using some sort of ID (potentially auto-generated, or manually disambiguated where necessary), you would just have to do a "reverse lookup" first to get the ID.

Similar to how it works in Qt: https://doc.qt.io/qt-5/i18n-source-translation.html#using-tr-for-all-literal-text

I'm a bit confused on the idea here in terms of Crowdin/bot integration. Are you suggesting something a bit like what the Desktop in/xml files do, where the .in files generate the .xml files? I'm not sure how the tsx files would generate the JSON file.

Basically I'm just asking what file(s) would https://crowdin.com/project/ruffle/es-ES track? If the strings stay in the tsx, we wouldn't want to duplicate them in a JSON file manually, and I'm not sure how we'd automate the JSON file creation. I don't know if Crowdin can directly track and translate based on tsx.

I think I'd prefer the t() function take both the English string and the id as parameters if we wanted to keep the strings in the tsx file, but the question is how Crowdin would work with this.

danielhjacobs avatar Dec 30 '24 19:12 danielhjacobs

Do you have any updates on this?

creeper-0910 avatar May 03 '25 03:05 creeper-0910

Ideally this will still be done, but https://github.com/martinkr/next-export-i18n has some limitations. Dinnerbone wants to switch to hosting the website not on GitHub pages, which will allow us to move away from the static export. That will let us use https://next-intl.dev/docs/getting-started/app-router/without-i18n-routing, which is more standard.

danielhjacobs avatar Jul 30 '25 14:07 danielhjacobs