Localization: How to change namespace and key and adapt them in blueprints?

Hey,

I need your help.
I need to set my own readable namespaces and keys and use them in my blueprints.
My idea is to have a data table which contains a namespace and several keys.

With those namespaces and keys, I want to find the correct text for my text variable.

I translated my text with the localization dashboard.

It looks like this:

{
	"FormatVersion": 2,
	"Namespace": "",
	"Subnamespaces": [
		{
			"Namespace": "[1C4423554685536FB6FB629328C21801]",
			"Children": [
				{
					"Source":
					{
						"Text": "Jeah, a Title!!"
					},
					"Translation":
					{
						"Text": "Jeah, a Title!!"
					},
					"Key": "48FA0828441C0FB8ED4B74B405030C20"
				},
				{
					"Source":
					{
						"Text": "Oh look, its a description"
					},
					"Translation":
					{
						"Text": "Oh look, its a description"
					},
					"Key": "4B2CADDE421432F89FA93AAE3A8ECEEC"
				},

So lets have an example:

I have in my data table a namespace like Quest_01 and two keys like Quest_01_Title and Quest_01_Description.
Now I have a UMG where I need to find the Text for my Quest Description.

FindTextInLocalizationTable

What I did was to change the namespace and the keys in the localization .manifest and .archive to this:

			"Namespace": "Quest_01",
			"Children": [
             {
                 "Source":
                 {
                     "Text": "Oh look, its a description"
                 },
                 "Translation":
                 {
                     "Text": "Oh look, its a description"
                 },
                 "Key": "Quest_01_Description"
             },

Did the same with the description.
The problem is, that the text is not found and the condition is false.
It works when I add the default namespace and keys which where generated after gathering the text.

Why shouldnt it work when I set the namespaces and keys by myself?
I can also add another namespaces and keys from other texts and it will be the correct text.
What did I wrong that it does not work when I set my own namespace or key?
In the localization dashboard, the keys correct and I see my own ones.

Thanks for your help! :slight_smile:

You can edit the namespace and key of a piece of text by using the drop-down next to the editable text field on a property or pin. If you export to PO rather than edit the archives directly (editing archives by hand isn’t recommended) then you’ll get the clean namespace that you entered rather than the version that includes the package localisation ID.

It sounds like what you really want though is a string table, which are available in 4.16+ if you’re able to upgrade.

Hey, thanks for your quick reply.
I will take a look into the string table tomorrow.
The reason why I was editing the archives by hand was just testing it out. I will also take a look into the export file again.
I dont wanna use the dropdown methode, because I need to find different texts for the same text variable depending on the progress of the user. For that reason I used the “find text in localization table” node.

So I took a look into the string table. Thanks for the info! This is easy going when I gather the text from there. Can set any key and namespace and the localization dashboard creates the localization files. All fine.

But what I dont understand is, why I can not find it in the blueprint with “Find Text in Localization Table”?

Using the drop down menu to set the namespace and key directly within the text variable also does not work. All works fine when I gather the text from the blueprint itself instead of the string table and use the namespaces and keys which are generated automaticly.

But I dont need that. I need to set my own namespaces and keys.

But when I set the namespaces and keys in the blueprint. It does not work. No result. Any Idea what Iam doing wrong?

So you’ve made a string table, gathered, translated, and compiled your text, and are now trying to find the text from the string table using the “Find Text in Localization Table” node?

Finding text in this way isn’t really recommended as it can be very fragile unless you’re meticulous at naming things. We also have the “Make Text from String Table” node which takes the string string table name (which is the asset path if you’re using an asset) and the key, although this is also not generally recommended, as linking a “Make Literal Text” node to a string table entry is much more robust.

Could you include a screenshot of your string table, and also the BP that’s trying to access the text?

Yes, “So you’ve made a string table, gathered, translated, and compiled your text, and are now trying to find the text from the string table using the “Find Text in Localization Table” node?” ← correct, this is what I did.

I’ve also tried the “Make Text from String Table” node, which is working fine, but it will just give me the text from the string table and not the translated one. Or did I missed something? (see screenshots)

I tried now again to find the text with the “Find Text in Localization Table” node. This time however it gives me a result (see screenshot). But the result is “1”!? Why is the result 1

My localization file for english (native culture) looks like this:

{
	"FormatVersion": 2,
	"Namespace": "",
	"Subnamespaces": [
		{
			"Namespace": "QuestStringTable",
			"Children": [
				{
					"Source":
					{
						"Text": "Temple Task"
					},
					"Translation":
					{
						"Text": "Temple Task"
					},
					"Key": "Quest_01_title"
				},
				{
					"Source":
					{
						"Text": "bla EN"
					},
					"Translation":
					{
						"Text": "bla EN"
					},
					"Key": "Test"
				}
			]
		}
	]
}

This one was generated from gathering the text of the string table.

For testing, the other culture will be German. The localizations looks the same, just the text of course is a little bit different.

211902-queststringtable.jpg

Oh, are you testing this in PIE? The editor doesn’t load any game localisations to avoid authoring issues, which will be why you’re getting the English result back from your string table (4.18 will add the ability to preview game localisation in the editor).

You can try running the editor with -game to run it in “game-mode”. This mode can load game localisations, and you can override the culture with -culture=code (eg -culture=de).

I don’t know why the other function returned 1 for the text. Is that also the value set on the description, or is the BP debugger confused?

Restart did it. After restarting the editor blueprint debugger and text value is correct.
I tried now the standalone Game Version. What I dont understand now is, that when I run the standalone game mode with -culture=de, it still gives me the english text!? I’ve read alot about localization in UE in the last days, did not saw anyone with this issue.
Tomorrow I will try this on android build after the android 23 upgrade, maybe it works there.

If this is solved, Iam really thankfull. Also the connection with the data table works now. I can find the correct text on the progress of the user now. I would love to avoid the string table, but Iam fine with this for now. I will try to continue on my own.

You probably need to adjust your packaging settings since by default we only package the ICU data for English.

If you go to Project Settings → Packaging, and I think the setting is called something like “Internationalization Support”. It will have a drop-down and likely be set to “English”, so try changing it to “EFIGS” or “All”.

Thanks alot.
I changed this but there was another issue.
The Internationalization path was missing in the game.ini

[Internationalization]
+LocalizationPaths=%GAMEDIR%Content/Localization/Test

Added this and it works!
Big thanks for your help :slight_smile:
Problem solved!