added "setTranslation" method to API

snap8
Jens Mönig 2022-04-05 09:16:28 +02:00
rodzic 5efac790b5
commit 87d7628606
3 zmienionych plików z 14 dodań i 2 usunięć

Wyświetl plik

@ -12,6 +12,7 @@
* new "position" choice in OF reporter's attribute dropdown, reports a list of XY coordinates
* new "categories" choice in MY reporter's dropdown, reports an ordered list of all category names whose indices match the "category" reported elsewhere
* new localization extension primitives in the "ide" category
* new support for setting the translation via the API
* new "Tad" costume series, thanks, Meghan and Brian!
* **Notable Changes:**
* exporting a library includes dependencies (auto-select all referenced blocks)
@ -35,6 +36,7 @@
### 2022-04-05
* gui, extensions: refactored callback synch for language-switching
* extensions: renamed localization extension prims
* api: added "setTranslation" method to API
### 2022-04-04
* objects: added speech-balloon-value-association support for ASK menu items

Wyświetl plik

@ -33,7 +33,7 @@
<script src="src/store.js?version=2022-03-22"></script>
<script src="src/locale.js?version=2022-03-31"></script>
<script src="src/cloud.js?version=2021-02-04"></script>
<script src="src/api.js?version=2022-01-03"></script>
<script src="src/api.js?version=2022-04-05"></script>
<script src="src/sha512.js?version=2019-06-27"></script>
<script src="src/FileSaver.min.js?version=2019-06-27"></script>
<script>

Wyświetl plik

@ -46,7 +46,7 @@ detect, isSnapObject, VariableFrame*/
// Global stuff ////////////////////////////////////////////////////////
modules.api = '2022-January-03';
modules.api = '2022-April-05';
// IDE_Morph external communication API - experimental
/*
@ -252,3 +252,13 @@ IDE_Morph.prototype.loadProjectXML = function (projectXML) {
IDE_Morph.prototype.unsavedChanges = function () {
return this.hasUnsavedEdits();
};
IDE_Morph.prototype.setTranslation = function (countryCode, callback) {
// switch to the specified language (format ISO 639-1 code) and
// optionally run a callback afterwards, e.g. to broadcast an event
// note the language setting does not overwrite the user's own setting
// that's stored in the browser this way, so that the next time the user
// opens Snap their own language setting again takes effect.
this.loadNewProject = false;
this.setLanguage(countryCode, callback, true); // don't save
};