Outdated translation replacement causing missing translation

Hi all.
With the update I made about 1 week ago, a button display problem appeared on the user profile page as follows. I thought it could be fixed with the update to be made in the following days, and although I made the ongoing updates, it did not improve.

1 Like

Does the text work on your profile here at Meta?

Have you customized the string in the past?

I also found this topic Turkish translation issue with share dialog so maybe try a rebuild.

4 Likes

There doesnā€™t seem to be any problem in meta. But the problem persists on my own site. I didnā€™t do any customization/localization.
I also tried the solution in the link you gave and rebuilt the Discourse. Unfortunately it didnā€™t work.

Have you tried a different browser or a private browsing / incognito tab?

Thank you for your concern.
I tried it in 4 different browsers and mobile. I can clearly say that it doesnā€™t work.

Then you have probably also tried safe mode already.

1 Like

The problem persists in Safe Mode unfortunately. . .

Moved this to support:

Seeing the text properly hereā€¦ are you sure you updated to absolute latest?

1 Like

When I check, I can see that it is up to date.
I canā€™t understand what caused this.


I think this is related to

I was able to reproduce the issue that the string for preferences in Turkish was broken. I customized js.user.preferences before updating and after the update the new js.user.preferences.title was broken.
Then I ran

TranslationOverride.where(translation_key: "js.user.preferences").delete_all
TranslationOverride.send(:reload_locale!)

and this fixed it :tada:

But I would wait for confirmation from someone with more knowledge before I would try to do this myself on a production site

3 Likes

When I check, the text value appears correct.

I changed the default text but it still didnā€™t work and the same problem persists.

Is it safe to do this in a production environment? Can someone guide?
No text customization works on the forum. It doesnā€™t just apply to this area.

1 Like

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, it was a string, so the translation override worked fine.

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.

How to reproduce

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

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

It seems that somehow, the status of this override was not updated to ā€œoutdatedā€

[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">
2 Likes

Iā€™ve slipped your repro over to the previous reports to keep them grouped together. :+1:

1 Like

Wow, I didnā€™t see there was a same bug report here ()

Iā€™m already tracking it down, but itā€™s weird, I think this should work fineā€¦ I donā€™t know whatā€™s going on here

2 Likes

This should be safe to do on a production site. :+1: (though please take a backup before attempting changes in the rails console, as accidents can happen)

Though if no text customisations are working, are you sure this is the same issue?

2 Likes

This issue has been resolved with the latest update. (3.4.0.beta1-dev)

1 Like

Yes, I also confirm that the issue has been resolved with the current update.

2 Likes

Just to round this out, hereā€™s the PR for the fix: :partying_face:

2 Likes

This topic was automatically closed after 14 hours. New replies are no longer allowed.