OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Feature: Add Multi-Language Translation Support for OpenMetadata Entities

Open harshach opened this issue 1 year ago • 3 comments

This feature adds comprehensive multi-language translation support for OpenMetadata entities, allowing users to view and manage metadata in their preferred language while maintaining the original English content as the source of truth.

Features Implemented

  1. Core Translation Infrastructure
  • Translation Storage: Added a translations field to entity schemas that stores translations as a list of locale-specific content
  • Translation Utility: Created TranslationUtil.java for applying translations based on locale
  • Patch Support: Implemented TranslationPatchUtil.java to handle translation updates via PATCH operations with locale parameter
  1. Supported Entities

The following entities now support multi-language translations:

  • Table - Including column descriptions and display names
  • Topic - Including message schema field translations
  • Container - Including data model column translations
  • Dashboard Data Model - Including column translations
  • Search Index - Including field translations
  1. REST API Enhancements

GET Operations

  • Added locale query parameter to GET endpoints (individual and list)
  • Example: GET /api/v1/tables/{id}?locale=es
  • Returns entity with Spanish translations applied

PATCH Operations

  • Added locale query parameter to PATCH endpoints
  • When locale is provided, displayName/description updates are stored as translations
  • Example: PATCH /api/v1/tables/{id}?locale=fr with patch operations on displayName/description

Supported Locales

  • Any valid locale code (e.g., 'en', 'es', 'fr', 'de', 'ja', 'zh-CN')
  • Fallback mechanism: 'es-MX' falls back to 'es' if specific variant not found
  • Default locale 'en' returns original content
  1. Nested Field Translations
  • Table columns: Each column can have translated displayName and description
  • Topic message schema fields: Nested field structures support translations
  • Container data model columns: Full translation support for nested columns
  • Dashboard data model columns: Column-level translations
  • Search index fields: Field-level translation support
  1. Key Design Decisions

Performance Optimization

  • Translations stored within entity JSON - no additional database queries
  • Lazy loading: Translations only applied when locale parameter is provided
  • Bulk operations optimized to preserve translations during field operations

Data Integrity

  • Original English content preserved as source of truth
  • Translations are supplementary - never modify core entity data
  • Translation updates via PATCH don't trigger version changes

API Compatibility

  • Fully backward compatible - no breaking changes
  • Locale parameter is optional, defaults to 'en'
  • Existing APIs work unchanged

Usage Examples

Viewing an Entity in Spanish

GET /api/v1/tables/customer_table?locale=es

Adding Spanish Translation

PATCH /api/v1/tables/customer_table?locale=es [ {"op": "replace", "path": "/displayName", "value": "Tabla de Clientes"}, {"op": "replace", "path": "/description", "value": "Tabla que contiene información de clientes"} ]

Listing Entities with Translations

GET /api/v1/topics?locale=fr

Technical Implementation Details

Repository Layer Changes

  • Added initializeChildrenTranslations() method to EntityRepository
  • Modified setFieldsInBulk() to preserve translations during bulk operations
  • Added patchWithTranslations() for locale-aware PATCH operations

Schema Updates

  • Added translations field to entity JSON schemas
  • Added translations field to Column, Field, and SearchIndexField types
  • Translations structure: {translations: [{locale: "es", displayName: "...", description: "..."}]}

Translation Application Logic

  • For default locale ('en'): Return original values
  • For non-default locale with translation: Apply translation
  • For non-default locale without translation: Return empty strings (signals translation opportunity)

harshach avatar Aug 31 '25 23:08 harshach

Out of interest, as we are a multi-language company, could you also add multi-language support for glossary terms?

chrisrayrayne avatar Sep 08 '25 05:09 chrisrayrayne

Hi, I couldn't join the Slack community since the slack link on the OpenMetadata web site seems dead. We are deeply interested in having multi-languages properties in entities, domains and terms. The initial pull request was pushed some months ago. Do you have any forecast about when this feature will be available ? In the description, REST API entities are not mentioned. Will they be addressed too ? As well as domains and terms and other remaining types like Database, DatabaseSchema and Dashboard ? Will all text properties (native and custom) be translated or only "displayName" and "description ? Thanks.

aurendabi avatar Jan 28 '26 16:01 aurendabi

@aurendabi slack link is updated just now. Thanks for notifying us. Please join the community and we can have discussion around this.

harshach avatar Jan 28 '26 17:01 harshach