Published on

Finding That Pesky "Translation Missing" Code in Shopify

Authors
  • avatar
    Name
    Entaice Braintrust
    Twitter

Finding That Pesky "Translation Missing" Code in Shopify

There was a time — not too long ago — when our band of digital explorers decided to embark on the journey of customizing our Shopify store. The promise of beautifully curated collections glinted like treasure at the end of a very technical rainbow. Armed with a tutorial from the vast lands of YouTube, we ventured forth, confident and slightly over-caffeinated. Sounds familiar, doesn’t it? When things didn't quite pan out, the aftermath was unexpected, less treasure, more leftover code: a mysterious "Translation missing: en.collections.sorting.title" laid in our path like a digital reminder of our ambitions.

Now, faced with the ghost of customization past, we needed to correct course. Fret not. We’ve wrangled through this one before — together, let’s dive into the code and find our way back to clarity.

Unraveling the Code Mystery: A Step-by-Step Guide

Our path begins with understanding where this code snippet — let's call it "the glitch" — comes from. Often, it's the remnants of additional features we tried to add. In this case, most likely from an attempted change to the way collections are sorted.

Step 1: Enter the Code Lair

Ah, the warmth of familiarity as we log into Shopify Admin. Here, we feel like intrepid explorers standing at the cave entrance to treasures untold. First, we must navigate to Online Store > Themes, and once there, hit the "Actions" button on the active theme. Then, like whispering an incantation, we select Edit code. This is where we keep our digital treasure map — the Theme Editor.

Step 2: Seek and Ye Shall Find

Now, we must seize our metaphorical magnifying glass. Several files within the code editor might hold the key.

Start with collection.liquid. This file is the throne room where everything collections-related is usually decided. Search for words like "sorting" or even "translation missing". If it feels like an absolute treasure hunt, it’s because, dear reader, it is.

Here’s a little code snippet you might find:

{% comment %}
Looks like there’s an interloper here!
{% endcomment %}
<div class="{{ section.settings.dropdown_class }}">
  {{ 'collections.sorting.title' | t }}
  ...
</div>

Step 3: Deciphering the Cipher

We’ve struck gold! The mysterious {{ 'collections.sorting.title' | t }} is often the culprit. It’s the Shopify translation pipeline’s way of telling us, waving frantically and saying, "Hey, we don’t have a translation for this".

One way to fix it? Remove it or swap it out for actual text. That code could look something like:

<p>Sort by:</p>

Step 4: The Search Continues

Sometimes our glitch may hide elsewhere, playing peekaboo. Other files worth looking at include snippets and sections like header.liquid or product-grid-item.liquid. Repeat our search and investigation in these realms. File by file, line by line — it's like going through library books for a lost bookmark.

Step 5: Test The Waters

Change a few lines, save them, then check your store page like a proud inventor of a newly baked potion. Does the mysterious text linger still? If yes, continue your expedition in another file. If not, savor the sweet taste of victory.

Our Shared Journey Through Code

There’s a peculiar joy in solving problems that challenge us — much like finding lost socks or rediscovering favorite songs from high school days. And remember, dear friends, exploration in Shopify’s code base can be as exhilarating as it is mystifying.

In our adventure today, we’ve removed the phantom code, bringing clarity back to our digital collection display. We’ve embraced the journey of trial and error, with shared smiles and a few harmless frustrations along the way. Happy coding, fellow explorers — may your Shopify realm be ever glitch-free!

Let’s never stop learning, searching, and sometimes second-guessing those YouTube tutorials. Who knows what strange gremlins lie beneath the next customization?