Code convention: Should we avoid fetching a translation if it's not used? #21
Replies: 1 comment 2 replies
-
Hey Will, thanks for kicking off this discussion 😃 There may be some consistency issues across the component files. However, we approached it this way due to some peculiarities with Liquid. The code you provided for This is a value fallback pipeline, so in this case, the If This is why in the first example with Is your main concern that this may lead to a translation never being used, or more so the formatting of how we're actually outputting this logic in Liquid? Because in your last example, if |
Beta Was this translation helpful? Give feedback.
-
I noticed two places where a translation is assigned, but potentially not used. Here and here.
Let's take one example:
In my own development patterns I tend to avoid using Liquid filters or assigning strings that aren't used.
Alternatives could be:
Or:
Which do others find most readable?
Beta Was this translation helpful? Give feedback.
All reactions