Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
El texto del componente Svelte no se actualiza

Estoy usando Blockly + SvelteJS, ahora estoy tratando de agregar soporte de idiomas. Así que tengo el componente Toolbox.svelte que se ve así:

 <xml id="toolbox" bind:this={toolbox} style="display:none"> <category name={Msg.CATEGORY_LOGIC} colour="#5b80a5"> <block type="controls_if" /> </category> </xml> <script> import Blockly from "blockly"; $: Msg = Blockly.Msg; export let toolbox = undefined; </script>

Y también tengo un script que tiene la función de actualización de configuración regional. Actualiza Blockly.Msg

 import Blockly from "blockly"; import {categoryNames as categoryEN, blockNames as blockEN} from "./en_US.json"; import {categoryNames as categoryRU, blockNames as blockRU} from "./ru_RU.json"; export function applyBlocklyLocale(locale) { switch (locale) { case "en": for (let key in categoryEN) { Blockly.Msg["CATEGORY_" + key.toUpperCase()] = categoryEN[key]; }; for (let key in blockEN) { Blockly.Msg["BLOCK_" + key.toUpperCase()] = categoryEN[key]; }; break; case "ru": for (let key in categoryRU) { Blockly.Msg["CATEGORY_" + key.toUpperCase()] = categoryRU[key]; }; for (let key in blockRU) { Blockly.Msg["BLOCK_" + key.toUpperCase()] = categoryRU[key]; }; break; }; Blockly.Msg = Blockly.Msg };

Pero cuando ejecuto esta función, Blockly.Msg se actualiza y toolbox xml no

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Esto no funcionará:

 $: Msg = Blockly.Msg;

La reactividad no cruza ciertos límites; solo funciona dentro de los componentes y a través de accesorios de componente a componente.

Tendrá que hacer esto a través de eventos o usar una tienda en su lugar para preservar las notificaciones de cambios y la reactividad.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!