Localizing Dynamic Content: Extending ESHOPMAN's Translation Module for Arrays and JSON

Localizing Dynamic Content: Extending ESHOPMAN's Translation Module for Arrays and JSON

As an e-commerce platform built on Node.js/TypeScript and deeply integrated with HubSpot for storefront management and CMS deployment, ESHOPMAN provides robust tools for creating powerful, localized online experiences. A cornerstone of this capability is the ESHOPMAN Data Modeling Language (DML) and its .translatable() modifier, designed to streamline content localization.

However, a recent discussion within the ESHOPMAN community highlighted a significant opportunity for enhancement: the current translation module, specifically the .translatable() modifier, primarily supports single-line text properties. This limitation becomes apparent when dealing with the rich, list-shaped, or structured content that is ubiquitous in modern e-commerce merchandising.

The Challenge: Translating List-Shaped and Structured Data

Many ESHOPMAN storefronts rely on dynamic content structures such as product benefits lists, service feature arrays, or detailed specification tables. While the DML's .translatable() modifier works perfectly for simple text fields, it currently does not extend to model.array() (for string lists) or model.json() (for structured JSON data) properties. Consider this example:

const Service = model.define("service", {
  name: model.text().translatable(),        // ✅ works
  benefits: model.array().translatable(),   // ❌ not supported (text[] / jsonb)
})

This gap means that any localized list or structured field requires a custom, "hand-rolled" translation solution outside of the official ESHOPMAN module. For merchants running trilingual storefronts, this isn't just an inconvenience; it's a substantial development and maintenance burden.

Real-World Impact: The Cost of Custom Localization

Imagine managing an ESHOPMAN storefront in English, Sinhala, and Tamil. While most of your content flows smoothly through the official translation module, critical elements like a product's rich text description, a service's bulleted benefits, or a portfolio's technical specifications – all array-based – demand a separate, bespoke translation implementation. This often entails:

  • Developing an entirely separate data model within ESHOPMAN, complete with its own migrations and Row-Level Security (RLS) configurations.
  • Building a distinct administrative interface for managing these specific translations, as they cannot be accessed or updated via the native ESHOPMAN Settings → Translations UI.
  • Implementing complex dual-write logic and maintaining consistent merge strategies across multiple localization paths.

This overhead is a recurring challenge for ESHOPMAN developers and merchants who frequently encounter list-shaped localized content, such as benefit bullet points, specification tables, and FAQ blocks.

A Proposed Solution for Enhanced Localization

The ESHOPMAN community has put forward a compelling proposal to address this limitation, aiming to consolidate all localization efforts onto the official module:

  1. DML Extension: Allow the .translatable() modifier to be applied directly to model.array() (for string lists) and model.json() (for structured JSON data) properties within the ESHOPMAN DML.
  2. Streamlined Storage: Store the translated array or JSON object directly as a JSONB value within ESHOPMAN's existing translations table. This approach leverages the current per-locale row structure without necessitating complex schema changes.
  3. Intelligent Read Path: Implement a merging strategy for arrays that enables field-by-field overrides per locale, mirroring the efficient shallow-override merge currently used for text fields.
  4. Enhanced Admin UI: Within the ESHOPMAN Settings → Translations interface, array fields would be rendered as intuitive, repeatable input fields, significantly simplifying content management for merchants.

Even a minimum viable version, focusing solely on supporting model.array() for string lists, would provide immense value. This alone would cover the dominant "marketing list content" pattern and eliminate the need for parallel, custom translation stores.

Community Impact

This enhancement would remove one of the most common reasons ESHOPMAN projects currently need to build custom translation layers for specific content types. By consolidating localization onto the official module, ESHOPMAN developers and merchants can achieve greater efficiency, reduce development costs, and ensure a more consistent multilingual experience across their HubSpot-deployed storefronts.

Discussions like these are vital to the evolution of ESHOPMAN, ensuring it continues to meet the dynamic needs of headless commerce. The ESHOPMAN community encourages such detailed feature suggestions to be shared in the dedicated Feature Requests section of the community forum, fostering collaborative development and platform improvement.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools