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.

Allow defaults to be lazy

See original GitHub issue

I like to do nested lookup, currently I do this:

i18n._({ 
     id: "resource.user.fields.username.label",
     defaults: i18n._({id: "fields.username.label",defaults: "Username"})
})

But this always resolves the default, I like this to be lazy:

i18n._({ 
     id: "resource.user.fields.username.label",
     defaults: i18n => i18n._({id: "fields.username.label",defaults:"Username"})
})

Thoughts ? (I think it’s relatively easy to implement)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
tricoder42commented, Oct 10, 2018

There’s already open issue for it #342. It might be easy to do by exporting compiler in subpackage as described here: https://github.com/lingui/js-lingui/issues/342#issuecomment-424687026. There’re might be few problems to solve, because lingui compile does few more things on top of compiling messages, as described at the end of this comment.

0reactions
tkvwcommented, Oct 10, 2018

There’re might be few problems to solve, because lingui compile does few more things on top of compiling messages, as described at the end of this comment.

That’s why I said a create compiler macro, which would generate a compiler.js (like the compiled catalogs) which contains the pluralize methods for the selected locales. This would allow the compiler to be small and support the required locales. But that’s just an idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I default to laziness? - Quora
Everyone tends to default to laziness. The first thing that differentiates the "active" ones from the "lazy" ones is the realisation that they're...
Read more >
How can I set the default behavior of lazy init in Spring Boot?
I want to set the that for default all beans are lazy loaded. I know that I can add the @Lazy to all...
Read more >
Lazy Initialization in Spring Boot 2.2 - Baeldung
By default in Spring, all the defined beans, and their dependencies, are created when the application context is created.
Read more >
React.lazy without a default export - DEV Community ‍ ‍
The React.lazy function lets you render a dynamic import as a regular component. Before: import OtherComponent from '.
Read more >
Enable lazy-load by default for responsive images - Drupal
Problem/Motivation In [#3167034], we added the basic pattern of how to add lazy loading for images to drupal. Let's continue that into ...
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