[BUG] Unable to localize two words with different meaning

Hello,

Assume, we want to localize two words, same in English but different in another language.
We are unable to do so because when using

NSLOCTEXT("namespace","TEXT_HELLO", "Hello!");
NSLOCTEXT("namespace","TEXT_WELCOME", "Hello!");

UE4 GatherText will assign our two Keys to one world.
Localization system is unable to handle situation where we have two different translations for TEXT_HELLO and TEXT_WELCOME in another language. It returns first record found in .archive file only.

Hi ksvg07,

You’ll need to put the words into different namespaces. This is currently the intended way of dealing with homographs.

NSLOCTEXT("namespace01","TEXT_HELLO", "Hello!");
NSLOCTEXT("namespace02","TEXT_WELCOME", "Hello!");

Identical text within the same namespace share translations. This is done to reduce translation costs and runtime memory.

So, what is the purpose of keys if they are not identyfing translation uniquely ?

The keys help us maintain a history for a “instance of text”. For example:

NSLOCTEXT(“namespace01”,“TEXT_HELLO”, “Hello!”);

was ever changed to…

NSLOCTEXT(“namespace01”,“TEXT_HELLO”, “Hello”);

then because the key remained stable we can show the translators that the only change was that the ! was removed and that their previous translation just needs a small modification.

This is a boon to translators, particularly with long pieces of text, which is magnified as iteration on existing text begins and reduces translation costs as a “review” is a lot cheaper than doing the whole translation again from scratch.