Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: Translate the website (excluding blogs) #358

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

danielhjacobs
Copy link
Collaborator

@danielhjacobs danielhjacobs commented Nov 13, 2024

Fixes #110

Screencast.from.2024-11-21.15-34-34.online-video-cutter.com.mp4

@danielhjacobs
Copy link
Collaborator Author

@danielhjacobs
Copy link
Collaborator Author

Switched to my own logic for translations.

@danielhjacobs
Copy link
Collaborator Author

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 danielhjacobs marked this pull request as ready for review November 16, 2024 05:38
@danielhjacobs
Copy link
Collaborator Author

@danielhjacobs danielhjacobs changed the title i18n: Proof of concept i18n: Translate the website (excluding blogs) Nov 21, 2024
"es-ES": "Español",
"sv-SE": "Svenska",
tr: "Türkçe",
uk: "Українська",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-coded list of languages and language codes should exactly match the extensions for the JSON language files we add.

Due to the way the logic is, it's probably best we use shorter codes whenever possible, so we may want to change:

"es-ES" to "es"
"sv-SE" to "sv"
"pt-PT" to "pt"
"zh-CN" to "zh"

@torokati44
Copy link
Member

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
Copy link
Member

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".

@danielhjacobs
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Are there any plans to make ruffle.rs multilingual?
2 participants