contextualize translations

snap7
jmoenig 2021-11-14 16:18:33 +01:00
rodzic fcef6db323
commit 825de3a30b
2 zmienionych plików z 18 dodań i 4 usunięć

Wyświetl plik

@ -54,6 +54,9 @@
* Chinese, thanks, Simon!
* Brazilian Portuguese, thank you, Cassiano D'Andrea!
### 2021-11-12
* locale: contextualize translations
### 2021-11-12
* store: fixed importing custom categories from libraries, thanks, Eckart, for reporting this!
* gui, objects, scenes, store: reverted to HSV as default pen color model

Wyświetl plik

@ -44,13 +44,13 @@
// Global settings /////////////////////////////////////////////////////
/*global modules, contains*/
/*global modules, contains, SpriteMorph*/
/*jshint esversion: 6*/
// Global stuff
modules.locale = '2021-November-11';
modules.locale = '2021-November-14';
var Localizer;
var SnapTranslator = new Localizer();
@ -67,10 +67,11 @@ function Localizer(language, dict) {
}
Localizer.prototype.translate = function (string) {
var phrase = this.contextualize(string);
return Object.prototype.hasOwnProperty.call(
this.dict[this.language],
string
) ? this.dict[this.language][string] : string;
phrase
) ? this.dict[this.language][phrase] : phrase;
};
Localizer.prototype.languages = function () {
@ -116,6 +117,16 @@ Localizer.prototype.unload = function () {
});
};
Localizer.prototype.contextualize = function (string) {
switch (string) {
case 'brightness':
return SpriteMorph.prototype.penColorModel === 'hsl' ?
'lightness' : string;
default:
return string;
}
};
// SnapTranslator initialization
SnapTranslator.dict.en = {