I have worked in companies that to achieve translations based on the user's localization they use a file to store those translations. However, when they try to access a translation on that file they commonly do it with "magic" strings like this:
Translate("$global.name")
Translate(string keyword);
is a function that looks up into these files with that keyword and the current user language code.
the xml file to access that translation looks like this:
<word code="$global.name">
<localization lang="es-MX">
<![CDATA[nombre]]>
</localization>
</word>
I have read that using magic strings is a bad practice since is subject to run-time errors and becomes a nightmare when you have to change a magic string in multiple locations.
How magic strings should be avoided in this situation?