Skip to content

SDK: Relationship field children returned in default language instead of specified locale when using getCollection().language().depth() #34162

@Neehakethi

Description

@Neehakethi

Description

When using the SDK's getCollection() method with .language() and .depth() parameters, the main content is returned in the correct locale, but relationship field children are returned in the default language instead of the specified locale.

Steps to Reproduce

  1. Have a dotCMS instance with multiple languages (e.g., English as default, French as secondary)
  2. Create a content type with a relationship field
  3. Create content with relationships in both languages
  4. Use the SDK to fetch content with language and depth:
client.content
    .getCollection("MyContentType")
    .language(4600065)    // French
    .depth(3)             // Include relationships

https://dotcms.freshdesk.com/a/tickets/34618

Expected Result

Both the main content AND all relationship field children should be returned in the specified language (French).

Actual Result

  • Main content: Returned in French ✅
  • Relationship children: Returned in English (default language) ❌

Affected Component

@dotcms/client SDK - CollectionBuilder

Workaround

Make direct API calls to /api/content/_search with languageId included as a separate field in the POST body.

Acceptance Criteria

  • Relationship children are returned in the specified language when using .language() with .depth()
  • Unit tests verify this behavior

Severity

Low- Minor Issue

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions