Skip to content

Commit

Permalink
Merge branch 'pr/1423' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Lionel Laské committed Dec 23, 2023
2 parents 9514eba + 2d5a1ab commit aa875f8
Show file tree
Hide file tree
Showing 23 changed files with 471 additions and 3,272 deletions.
1 change: 0 additions & 1 deletion activities/Speak.activity/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<meta charset="utf-8" />
<title>Speak Activity</title>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, viewport-fit=cover"/>
<link rel="prefetch" type="application/l10n" href="locale.ini" />
<link rel="stylesheet" media="not screen and (device-width: 1200px) and (device-height: 900px)"
href="lib/sugar-web/graphics/css/sugar-96dpi.css">
<link rel="stylesheet" media="screen and (device-width: 1200px) and (device-height: 900px)"
Expand Down
51 changes: 15 additions & 36 deletions activities/Speak.activity/js/SpeakActivity.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(["sugar-web/graphics/palette","sugar-web/env","webL10n","sugar-web/datastore","sugar-web/activity/activity"], function (palette,env,l10n,datastore,activity) {
define(["sugar-web/graphics/palette","sugar-web/env","l10n","sugar-web/datastore","sugar-web/activity/activity"], function (palette,env,l10n,datastore,activity) {

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d');
Expand Down Expand Up @@ -66,6 +66,7 @@ define(["sugar-web/graphics/palette","sugar-web/env","webL10n","sugar-web/datast
var defaultLanguage = (typeof chrome != 'undefined' && chrome.app && chrome.app.runtime) ? chrome.i18n.getUILanguage() : navigator.language;
if (!environment.user) environment.user = { language: defaultLanguage };
sugarSettings = environment.user;
l10n.init(defaultLanguage);
speech.init(sugarSettings);
// If not IE, setup mouse for capture
if (!IE){
Expand All @@ -77,7 +78,7 @@ define(["sugar-web/graphics/palette","sugar-web/env","webL10n","sugar-web/datast
}, 1000/FPS);
window.addEventListener('localized', function() {
if (first) {
l10n.language.code = sugarSettings.language;
l10n.init(sugarSettings.language);
first = false;
return;
} else {
Expand Down Expand Up @@ -389,40 +390,18 @@ define(["sugar-web/graphics/palette","sugar-web/env","webL10n","sugar-web/datast
}

function localize() {
document.getElementById('gamemode1-button').title = l10n.get("TypeSomethingToHear");
document.getElementById('gamemode2-button').title = l10n.get("AskRobot");
document.getElementById('gamemode3-button').title = l10n.get("VoiceChat");
document.getElementById('language-button').title = l10n.get("Language");
document.getElementById('speech-button').title = l10n.get("Speech");
document.getElementById('face-button').title = l10n.get("Face");
document.getElementById('ratelabel').innerHTML = l10n.get("ratelabel");
document.getElementById('pitchlabel').innerHTML = l10n.get("pitchlabel");
document.getElementById('eyesnumber').innerHTML = l10n.get("eyesnumber");
document.getElementById('eyes').title = l10n.get("eyes");
document.getElementById('glasses').title = l10n.get("glasses");
document.getElementById('speakText').title = l10n.get("speak");
document.getElementById('lang-en').innerHTML = l10n.get('langen');
document.getElementById('lang-ca').innerHTML = l10n.get('langca');
document.getElementById('lang-cs').innerHTML = l10n.get('langcs');
document.getElementById('lang-de').innerHTML = l10n.get('langde');
document.getElementById('lang-el').innerHTML = l10n.get('langel');
document.getElementById('lang-eo').innerHTML = l10n.get('langeo');
document.getElementById('lang-es').innerHTML = l10n.get('langes');
document.getElementById('lang-fi').innerHTML = l10n.get('langfi');
document.getElementById('lang-fr').innerHTML = l10n.get('langfr');
document.getElementById('lang-hu').innerHTML = l10n.get('langhu');
document.getElementById('lang-it').innerHTML = l10n.get('langit');
document.getElementById('lang-kn').innerHTML = l10n.get('langkn');
document.getElementById('lang-la').innerHTML = l10n.get('langla');
document.getElementById('lang-lv').innerHTML = l10n.get('langlv');
document.getElementById('lang-nl').innerHTML = l10n.get('langnl');
document.getElementById('lang-pl').innerHTML = l10n.get('langpl');
document.getElementById('lang-pt').innerHTML = l10n.get('langpt');
document.getElementById('lang-ro').innerHTML = l10n.get('langro');
document.getElementById('lang-sk').innerHTML = l10n.get('langsk');
document.getElementById('lang-sv').innerHTML = l10n.get('langsv');
document.getElementById('lang-tr').innerHTML = l10n.get('langtr');
document.getElementById('lang-zh').innerHTML = l10n.get('langzh');
var ids = ["gamemode1-button", "gamemode2-button", "gamemode3-button", "language-button", "speech-button", "face-button", "ratelabel", "pitchlabel", "eyesnumber", "eyes", "glasses", "speakText", "lang-en", "lang-ca", "lang-cs", "lang-de", "lang-el", "lang-eo", "lang-es"];
var properties = ["title", "title", "title", "title", "title", "title", "innerHTML", "innerHTML", "innerHTML", "title", "title", "title", "innerHTML", "innerHTML", "innerHTML", "innerHTML", "innerHTML", "innerHTML", "innerHTML"];
var l10nKeys = ["TypeSomethingToHear", "AskRobot", "VoiceChat", "Language", "Speech", "Face", "ratelabel", "pitchlabel", "eyesnumber", "eyes", "glasses", "speak", "langen", "langca", "langcs", "langde", "langel", "langeo", "langes"];

for (var i = 0; i < ids.length; i++) {
var element = document.getElementById(ids[i]);
if (element) {
element[properties[i]] = l10n.get(l10nKeys[i]);
} else {
console.warn('Element with id ' + ids[i] + ' not found');
}
}
}

init();
Expand Down
3 changes: 3 additions & 0 deletions activities/Speak.activity/lib/axios.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions activities/Speak.activity/lib/i18next.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit aa875f8

Please sign in to comment.