scratchfoundation / scratch-gui

Graphical User Interface for creating and running Scratch 3.0 projects.
https://scratchfoundation.github.io/scratch-gui/develop/
BSD 3-Clause "New" or "Revised" License
4.43k stars 3.52k forks source link

Translation for libraries #491

Open chrisgarrity opened 7 years ago

chrisgarrity commented 7 years ago

Expected Behavior

When you open the sprite/backdrop/costume/sound libraries and your language is set to something other than English, the names of the items should be in the user's language.

When you search for something in another language, results that match that language should appear. This implies that tags have been translated in addition to names so that the search can match translated tags.

Actual Behavior

In Scratch 2.0 the library categories are translated, but the names of the individual items are not. So this is an enhancement over 2.0. However, we need to design the libraries with translation in mind or it'll never happen.

chrisgarrity commented 7 years ago

Currently libraries are json. We will probably need them to be javascript to be able to translate the names.

greenat92 commented 7 years ago

Hi @chrisgarrity, I'm Benzahia Lakhdar CS teacher , Also native Arabic speaker, I'm from Algeria we're using scratch in our educational system, I'm interested to contribute in this feature especially with Arabic/french localization, I've added Arabic to language-selector. ( see code link ), If you would like to add this suggested collaborative work let me know to create my first PR and start working with you on this feature it's my pleasure :+1: .

Thanks,

chrisgarrity commented 7 years ago

@LBenzahia so far I've just been working on getting the process for localization settled. It would be useful to have someone trying it out with RTL languages like Arabic. I'll add Arabic to the Experimental Scratch project on Transifex https://www.transifex.com/llk/experimental-scratch. I can invite you to join that project as a translator, but keep in mind this is all for experimenting, so the point of translating would be to have real examples, and the strings will likely change before we're finished.

greenat92 commented 7 years ago

@chrisgarrity,

I can invite you to join that project as a translator

Big yes, I agree to be with you, My userName "LBenzahia", my profile I just have created this account.

wangguoqin1001 commented 7 years ago

There could be a large number of items in these libraries, and putting all of them in the translation file could be quite confusing. Instead I would recommend leave the translations in the json files, like this,

"name": {"default": "blablabla", "zh": "Chinese"}

But I got to get the current locale setting from react-intl and I'm still working on this, since I'm not familiar with react at all :(

chrisgarrity commented 7 years ago

@wangguoqin1001 it's more likely that "name" will be a key value like 'spritelibrary.dragon', and we will look up that key in the localization table for the current locale. or an object like

"name": {"default": "Dragon", "id": "spriteLibrary.dragon"}

In that way the source file for the library doesn't have to change each time there's a new translation for some item in the library.

wangguoqin1001 commented 7 years ago

Hmm that depends on who's responsible for new items in the libraries. As we're using Scratch and adding our own sprites and backdrops to the libraries, it might be better for us to define most of the translations ourselves in the library files, as others wouldn't necessarily know what these resources are. But for official ones, it might get more people involved by adding new translation. I'm a little confused how the libraries in Scratch 3.0 would be. Would it be just the official ones hosting on MIT server, or would it open to third-party library providers?

chrisgarrity commented 7 years ago

@wangguoqin1001 good point, right now this is just considering official libraries.

breenworks commented 6 years ago

A language-related issue I discovered while teaching in Russia is the lack of support in the Scratch 2.0 Paint Editor for Cyrillic text. Please note the SAY/THINK blocks do support Cyrillic text, but not the Text tool in either the Bitmap or Vector Paint Editor.

chrisgarrity commented 6 years ago

@breenworks thanks for the reminder. We're actively working on the paint editor for Scratch 3.0 and will need to make sure that the new paint editor text tool supports non-latin characters sets.

kyleplo commented 6 years ago

Why not just have multiple JSON files, one for each language?

chrisgarrity commented 6 years ago

@kyleplo it's not just having copies of json files - we need to set up the workflow to add the names to our translation system (www.transifex.com), and automatically pull the translations from transifex when we're building the system.

thisandagain commented 6 years ago

It looks like this feature is unlikely to make it into the release. We will address post-August.

gunchleoc commented 5 years ago

I think we should make the design as similar as possible to / identical to the other Scratch Editor translations. I would like to take on thus bug so that we won't have to wait until post-August, but I am currently being blocked by https://github.com/LLK/scratch-gui/issues/4718

apple502j commented 5 years ago

@gunchleoc It's already post August, thisandagain meant last year's one.

gunchleoc commented 5 years ago

Chris said in an e-mail that it would take another 6 months at least, so that pretty much still fits with this year's August... which is why I didn't notice the year ;)

gunchleoc commented 5 years ago

@chrisgarrity I have started looking into the code now and will use the design of the library tags as a baseline to work off of. I'd like to know which of the following files are autogenerated and if so, which script to run for updating them.

chrisgarrity commented 5 years ago

@gunchleoc almost everything in the scratch-l10n repository is generated. The build process npm run build for the repository: https://github.com/LLK/scratch-l10n generates the files used by dependent repos from the json files downloaded from transifex.

Once there is a new resource in transifex, it should become part of the scratch-l10n library (either as part of interface-msgs, or a new file). The messages (source and translations) in scratch-l10n are what ends up used by gui.

gunchleoc commented 5 years ago

Thanks for the info!

I think it would be ideal if the libraries ended up as a separate resource file in transifex, but splitting the source strings into 'libraries' and 'everything else' may be more work that it's worth.

From a localizer's point of view, I think it would be well worth the effort to have 1 extra resource for all library objects. We could move the already translatable categorization tags over there as well.

apple502j commented 4 years ago

@BryceLTaylor This is a great thing to add - it should at least receive prio 5. I know libraries have several tech debts but if library file gen is open-sourced it may be easier to investigate those tech debts (and add new features, like this).