Skip to content

fix: preserve user-customized object/field names across locale changes#19067

Closed
jnMetaCode wants to merge 1 commit intotwentyhq:mainfrom
jnMetaCode:fix/i18n-preserve-custom-names-18950
Closed

fix: preserve user-customized object/field names across locale changes#19067
jnMetaCode wants to merge 1 commit intotwentyhq:mainfrom
jnMetaCode:fix/i18n-preserve-custom-names-18950

Conversation

@jnMetaCode
Copy link
Copy Markdown

Summary

  • Fixes user-customized Data Model object and field names being overwritten by i18n translations when the UI language is changed
  • Changes the resolution priority so direct standardOverrides (user customizations) always take precedence over locale-specific translations and auto i18n translations
  • For field metadata, removes the SOURCE_LOCALE-only restriction that was preventing customizations from being applied in non-English locales

Root Cause

In resolveObjectMetadataStandardOverride and resolveFieldMetadataStandardOverride, the priority order was:

  1. standardOverrides.translations[locale] (locale-specific translations)
  2. standardOverrides[labelKey] (user customizations)
  3. Auto i18n translation fallback

For field metadata, the direct override check (step 2) was additionally gated behind locale === SOURCE_LOCALE, meaning user customizations were completely ignored in non-English locales.

The fix reorders the priority to:

  1. standardOverrides[labelKey] (user customizations)
  2. standardOverrides.translations[locale] (locale-specific translations)
  3. Auto i18n translation fallback

This ensures that when a user renames "Company" to "ASTF", that name persists regardless of the active UI locale.

Test plan

  • Updated existing unit tests in resolve-object-metadata-standard-override.util.spec.ts
  • Updated existing unit tests in resolve-field-metadata-standard-override.util.spec.ts
  • Set UI language to English, rename a standard object (e.g., Company → ASTF), switch to German — ASTF should persist
  • Set UI language to German, rename a standard object — the custom name should persist after refresh
  • Verify that uncustomized standard objects still show translated labels in non-English locales

Fixes #18950

User-customized names (stored as direct standardOverrides) were being
overridden by i18n translations when switching UI language. This changes
the priority order so direct overrides always take precedence over
locale-specific translations and auto i18n translations.

For field metadata, the direct override was previously only applied when
locale matched SOURCE_LOCALE (English), meaning customizations were
completely ignored in non-English locales.

Fixes twentyhq#18950
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions
Copy link
Copy Markdown
Contributor

Welcome!

Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our Contributor License Agreement.

Generated by 🚫 dangerJS against e8cdf1d

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@jnMetaCode
Copy link
Copy Markdown
Author

Closing this PR. Apologies for the noise — I'll take more care to ensure quality and proper testing before submitting future contributions.

@jnMetaCode jnMetaCode closed this Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data Model custom object names are lost when switching UI language — renaming only works in English

1 participant