Localization - entries duplication in User Widgets

The main issue is that filling Text fields with same value using same localization key and namespace results in multiple entries in localization dashboard.

I have localization configured to gather text from Packages (having *.uasset as enabled extension). Imagine following configuration:

  • I have MainMenuWidget (descendant of UserWidget). It contains WidgetSwitcher and there is SettingsWidget within it. (This widget is added to player screen.)
  • Setting Widget (again desc. of UW) contains GraphicsSettingsWidget (GSW), which has multiple widgets - SliderWithValue (SVW).
  • This SliderWithValue is custom user widget (again it is descandant of UW) having slider and text field showing slider’s value. As a Public variable, it exposes List of FText (exposing on Spawn), lets call it LOFT
  • For each SVW in GSW I add single element to LOFT with following configuration: (Text: Nízká (en translation is Low, Package:1A3EFF3C42038BA4861D69995A78B95F (predefined, not editable),Namespace: TCF2LocSpace, Key: LC.Low)
  • Now I compile and save all (no BP or C++ errors) and run Gather Text

I have edited exported PO file to contain only affected enties: edited PO file with (TXT association). As you can see, there are 4 entries with correct settings, but 6 another entries, got from (I believe) some generated object.

My question is:

  1. Do I really need to translate items from generated files? Why do I see them anyway? This is some kind of intermediate object I don’t really want to bother.
  2. I applyed this settings to 5 items, why there are 2 items with same Key, but different msgctxt? There should be only one entry for all 5 items (except items where it was not correctly defined, but that is not this case), right?

Cleaning and rebuilding solution did not solved my problem. For more investigation, you can use this GitHub commit:.com/halbich/TauCetiF2/tree/0a954663da20bf80bf6df8d405daa05715a83d6c.

Thx in advance.

Hello ,

I’ll be investigating this to see if I can get the same behavior to occur but I wanted to ask first; What type of variable is List of FText? Is it an FText array or is a struct with FText variables inside of it?

Edit: Disregard, I just noticed that you provided a test project.

After speaking with our localization team (the ones who develop the Dashboard), they mentioned that an issue related to this was fixed in 4.15. Could you make a copy of your project and try upgrading the copy to 4.15 to see if the issue is resolved for you?

I tested it and I can confirm that this issue is solved.
However during test process I found another glitch with localization dashboard. It looks like it is not affecting actual translation during gameplay.

Original line in .cpp file is:
SelectTargetComponent->CustomUsingMessage = NSLOCTEXT(“TCF2LocSpace”, “LC.UseTerminal”, “Použít / Otevřít”);

and in Localization Dashboard I can see “Pou??t / Otev??t”. As you can see from opened Game.archive in Notepad++, archive seems to be incorrectly filled as well.

(I’m using x64 Win10 with Czech localization and culture settings)

Are you able to reproduce this behavior?

Is the source file you’re gathering that text from saved as UTF-8? UE4 only understands ANSI and Unicode, so if it’s saved in a different Windows codepage then UE4 may be misinterpreting it as ANSI.

In both Windows Notepad and Notepad++ it looks like it is saved in ANSI.Both editors had no problem displaying czech characters.
And if I’m not mistaken, I created that cpp file from UE Editor (using add C++ class)
I will do a few tests later today and we will see, if I can find more on this topic.

Hi, so from my testing it lookes like there is problem with BOM when using UTF-8. I changed C++ files to specifically use UTF-8-BOM and voila, now I can see correct text both in Dashboard and in Game.
When I changed file to UTF-8 without it, problem reappeared.

Hmm, that’s interesting. FFileHelper::BufferToString treats everything that doesn’t contain a UTF-16 BOM as UTF-8, and will just walk over the UTF-8 BOM if it exists.

What did you use to change the encoding of your file? Notepad++?

Yeah. On my computer I created new C++ actor, wrote NSLOCTEXT …, compiled (btw, will be HotReloading fixed in 4.15.1? Now I need to restart UE every time I change code, which kinda …) and run Gather text. instead of characters with czech diacritics I saw “?”. So I opened Notepad++, converted to UTF-8 (file encoding description in right bottom corner changed from UTF-8 to UTF-8-BOM), recompiled, gathered and czech characters were correctly displayed (although I changed native localization to EN and then to CS back again to perform clean gather).

Hey , I just wanted to chime in about the hot reloading thing; That’s actually a false error message from Visual Studio. The hot reload should still be completing successfully despite what Visual Studio is telling you. We have a bug in for that here: UE-42205

Hi Matthew, actually UE 42205 is not the thing. I saw message that hotreaload was successfull but nothing changed (lets say when I added printing message to the log and compiled). Anyway, yesterday I found out that I have few issues with my solution - I was able to compile it and run without errors, even with circular dependency between my game modules. And maybe this was the reason why my hotreloading is broken. So I’ll clean up my source and If the hotreloading problem will still be occuring, I’l let you know.
It is funny that I introduced this circular dependency maybe a few weeks ago and then I worked on it without problem (I also completely Rebuilt project few times) and I needed fresh checkout from git by my friend ti find out that my solution is not buildable at all.

So, I managed to modify my solution and it is correct now. However, I for example did following: (My setup is main game module with multiple non primary game modules) I modified type of property in two separate modules (one is successor of UObject, one is struct and it is only container for binary saving), reload was successful (meaning no compile errors), but I still got this message:

LogModuleManager:Warning: ModuleManager: Unable to load module ‘C:/Users/Halbich/Documents/GitHub/TauCetiF2/Binaries/Win64/UE4Editor-TauCetiF2-271.dll’ because the file couldn’t be loaded by the OS.
Warning: HotReload failed, reload failed /Script/TauCetiF2.

In previous version 4.14.3 I was able to HotReload my project without problems.

If you’d like to, I can provide my project and elaborate steps to reproduce this behavior (would it be better to post it it as a new question?)

It would be best to keep this question related to the localization problem. Please make a new question if you still require assistance with the Hot Reload issues that you’re experiencing.