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.

Is it ok to reuse Prism object when loading multiple languages?

See original GitHub issue

Hey

I noticed that if I do:

loadLanguages(["javascript"]);

and then later loadLanguages(["markup", "javascript"]);

Then the second one won’t parse the javascript. However if ["markup", "javascript"] is loaded first it works correctly.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
mAAdhaTTahcommented, Apr 22, 2018

Wow, nice catch.

If we wanted to still avoid said second parameter, we’d have to resolve them in the loadLanguages function, e.g. when we do this:

loadLanguages(['markup', 'javascript']); loadLanguages('markup');

We’d have to reload javascript after we’ve loaded markup the second time.

Is that “optional dependency” made explicit anywhere? We could add optional dependencies to components.js, and reload them conditionally based on whether they’ve been loaded already or not.

It’s not ideal, from an implementation perspective, but I’d much rather pull that complexity into Prism rather than expecting users to understand whether or not they should be invalidating the cache. Understanding whether to do so requires users to understand Prism’s internals, which I’d like to avoid even at the expense of making loadLanguages more complex.

1reaction
mAAdhaTTahcommented, Apr 15, 2018

Basic idea is this:

delete require.cache[require.resolve(pathToLanguage)]

Would make a Good First Issue™.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PRISM - Reuse of Views With Child Regions - Can It Be Done?
1 Answer 1 · Take a look at my answer here, to see how child views can get the locally scoped RegionManager (very...
Read more >
Reusable Object or Components | Blue Prism Product
RE: Reusable Object or Components​​ If you haven't already, definitely it out as objects uploaded there will be checked by the Blue Prism...
Read more >
Composing the User Interface Using the Prism Library for WPF
The root object in a composite application is known as the shell. The shell acts as a master page for the application. The...
Read more >
Processing multi language data using Flat File - IBM
The object structures, as designed, can accept only one language at a time. So, for example, you could import English characters using EN...
Read more >
Overcoming challenges with multilingual content reuse
Because they are designed to stand alone, topics can be reused identically across multiple content types. When designed for maximum reuse, ...
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