pxt-arcade 1.13.29 → 1.13.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/built/editor.js CHANGED
@@ -230,8 +230,6 @@ var pxt;
230
230
  tileHitParam.appendChild(shadow);
231
231
  block.appendChild(tileHitParam);
232
232
  });
233
- }
234
- if (pxt.semver.strcmp(pkgTargetVersion || "0.0.0", "0.18.9") < 0) {
235
233
  /**
236
234
  * move from tilemap namespace to tiles namespace
237
235
  * <block type="tilemap_locationXY">
@@ -248,6 +246,46 @@ var pxt;
248
246
  xyField.textContent = (xyField.textContent || "").replace(/^tilemap./, "tiles.");
249
247
  });
250
248
  }
249
+ if (pxt.semver.strcmp(pkgTargetVersion || "0.0.0", "1.12.34") < 0) {
250
+ const lang = pxt.BrowserUtils.getCookieLang();
251
+ if (lang == "es-MX") {
252
+ // on player 2 a button pressed
253
+ pxt.U.toArray(dom.querySelectorAll("block[type=ctrlonbuttonevent]"))
254
+ .forEach(eventRoot => {
255
+ swapFieldIfNotMatching(eventRoot, "button", "controller", "ControllerButton.");
256
+ });
257
+ }
258
+ else if (lang === "es-ES") {
259
+ pxt.U.toArray(dom.querySelectorAll("[type=music_sounds]>field[name=note]"))
260
+ .forEach(node => node.setAttribute("name", "name"));
261
+ // on a button pressed
262
+ pxt.U.toArray(dom.querySelectorAll("block[type=keyonevent]"))
263
+ .forEach(eventRoot => {
264
+ swapFieldIfNotMatching(eventRoot, "event", "button", "ControllerButtonEvent.");
265
+ });
266
+ // on player 2 a button pressed
267
+ pxt.U.toArray(dom.querySelectorAll("block[type=ctrlonbuttonevent]"))
268
+ .forEach(eventRoot => {
269
+ swapFieldIfNotMatching(eventRoot, "button", "controller", "ControllerButton.");
270
+ });
271
+ }
272
+ else if (lang === "de") {
273
+ pxt.U.toArray(dom.querySelectorAll("block[type=image_create]>value[name=heNacht]"))
274
+ .forEach(node => node.setAttribute("name", "height"));
275
+ }
276
+ }
277
+ }
278
+ function swapFieldIfNotMatching(eventRoot, fieldAName, fieldBName, fieldAShouldStartWith) {
279
+ const fieldA = eventRoot.querySelector(`field[name=${fieldAName}]`);
280
+ const fieldB = eventRoot.querySelector(`field[name=${fieldBName}]`);
281
+ if (!fieldB || !fieldA)
282
+ return;
283
+ if (!fieldA.innerHTML.startsWith(fieldAShouldStartWith)
284
+ && fieldB.innerHTML.startsWith(fieldAShouldStartWith)) {
285
+ // swapped by invalid translation we now catch; swap back
286
+ fieldA.setAttribute("name", fieldBName);
287
+ fieldB.setAttribute("name", fieldAName);
288
+ }
251
289
  }
252
290
  function changeVariableToSpriteReporter(varBlockOrShadow, reporterName) {
253
291
  const varField = getField(varBlockOrShadow, "VAR");