question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic change of language

See original GitHub issue

Hello, I am able to change language as mentioned in you guide. My app comunicate with editor with messages. When I sent message with data to change language, ContentEdit.LANGUAGE is changed as intended, but language stays the same. Am I missing something? Can you advice me, how to change language dynamicaly?

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Jakuboslavcommented, Nov 2, 2019

Oh, perfect, it works out of box!

Thanks a lot for your help, you saved my day.

0reactions
anthonyjbcommented, Nov 2, 2019

OK so if you need to do this reactively it’s likely you’d need to determine what’s active on the screen currently (toolbox, dialog, etc) and basically use unmount/mount for each (including applying the active widget class to each).

Since most of the time the only relevant UI component is the toolbox (as it’s the only one with translated content that’s mounted from the moment the editor is initialized) the following code works for me in the sandbox demo.

message.listen('set-language', data => {
  ContentEdit.LANGUAGE = 'en'
  const editor = ContentTools.EditorApp.get()

  if (editor.isEditing()) {
    const toolbox = editor.toolbox()

    if (toolbox) {
      toolbox.unmount()
      toolbox.mount()
      toolbox.addCSSClass('ct-widget--active')
    }
  }
})

Hopefully this helps you for now or at least points you in the right direction - let me know if you have further issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Language Dynamics and Change - Brill
This international peer-reviewed journal covers both innovative and traditional aspects of the study of language change.
Read more >
Dynamics of Language Changes - Springer Link
This book explores the dynamics of language changes from sociolinguistic and historical linguistic perspectives, advances current research in language ...
Read more >
The dynamic change of a language - The Statesman
Who knows whether, in the near future, most people in the world will end up speaking Chinese, or Arabic, or Spanish? There are...
Read more >
Dynamics of Language Changes: Looking Within and Across ...
Each chapter explores a different component of language change, including typology, syntax, morphology, phonology, semantics, lexicology, discourse strategies, ...
Read more >
Dynamic Language Switching | Internationalization - Flylib.com
Dynamic Language Switching · Provide a means by which the user can switch language. · For every widget or dialog, set all of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found