# Outdated translation replacement causing missing translation

**URL:** <https://meta.discourse.org/t/outdated-translation-replacement-causing-missing-translation/314352>\
**Category:** Bug\
**Tags:** translation, fixed\
**Created:** [June 30, 2024, 1:26pm UTC](https://meta.discourse.org/t/outdated-translation-replacement-causing-missing-translation/314352 "2024-06-30T13:26:14Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)\
**Post date:** [July 23, 2024, 9:11am UTC](https://meta.discourse.org/t/outdated-translation-replacement-causing-missing-translation/314352/16 "2024-07-23T09:11:55Z")

</div>

TL;DR: The existing translation override rudely overrides the outdated custom translation with the new translation, causing type issues. Or, here, failed to update the outdated translation override to “outdated”

## The issue

The forum I manage has an override for the translation `js.user.preferences`. Before [this commit](https://github.com/discourse/discourse/commit/7d4ff77a14aac07c521df01e561e9f98d874398c#diff-aa4d8963befa2d4e20c89aa78df811edde5324d37a990eaf783a2aaf44a44d0cR1060-R1063), it was a string, so the translation override worked fine.

 ![](https://global.discourse-cdn.com/meta/original/4X/2/0/2/20224df34dfad077d1da9f9afdc34938acf61c32.png)

After this commit, the key becomes an object. However, the translation override does not detect the key type, but directly overrides it to the old defined string. This causes the translation of the key to be missing in the interface.

 ![](https://global.discourse-cdn.com/meta/original/4X/2/c/6/2c656ecb2de15482c89b7a9fb5fe086325285bb9.png)

 ![](https://global.discourse-cdn.com/meta/original/4X/6/e/e/6eee7b2b48ee4e1b1be171030561beb1b50043d0.png)

## How to reproduce

For latest forums, this seems to require manually inserting an outdated record to trigger

```SQL
INSERT INTO translation_overrides
  (locale, translation_key, value, created_at, updated_at)
VALUES 
  ('en', 'js.user.preferences', 'test', current_timestamp, current_timestamp);

```

Then modify a site text at random to trigger the update

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/7/0/d70ec280e155d120483c16ef089ae2b1fa0b4093.png)

It seems that somehow, the status of this override was not updated to “outdated”

```irb
[5] pry(main)> TranslationOverride.last
  TranslationOverride Load (1.2ms) SELECT "translation_overrides".* FROM "translation_overrides" ORDER BY "translation_overrides"."id" DESC LIMIT 1
=> #<TranslationOverride:0x00007f0b20a31e20
 id: 18,
 locale: "en",
 translation_key: "js.user.preferences",
 value: "test",
 created_at: Tue, 23 Jul 2024 17:08:17.317404000 UTC +00:00,
 updated_at: Tue, 23 Jul 2024 17:08:17.317404000 UTC +00:00,
 compiled_js: nil,
 original_translation: nil,
 status: "up_to_date">

```

---

_[View the full topic](https://meta.discourse.org/t/outdated-translation-replacement-causing-missing-translation/314352)._
