Very nice question (+1). I believe that in 2006 there was one discussion on one of the Drupal mailing lists. Key developers have fiercely defended the current i18n and l10n infrastructure designs. The problem of homonyms for the Indo-European languages ββis limited, but when you move, for example, to China, it becomes overwhelming, since each ideogram in Chinese represents a bunch of completely different concepts, and you can get the intended one only by looking at the context.
Although there is no coded solution for homonyms, there is a very simple best practice: provide context! If possible, provide the t () function with sentences, not separate words, or say this with the code documentation in common.inc :
When using t (), try putting whole sentences and strings in one call to t (). This makes it easier for translators, as it provides a context for what each word refers to.
If this is not possible, and using synonyms with a different spelling is not an option , you can embed transparent HTML tags that provide context for the translation . For instance:
$heading = "<h2>" . t("<span id="product-as-in-stores">Product</span>") . "</h2>";
This way you provide important information to translators, and if you just nested the <h2> tags, the translator would have to guess what the product belongs to.
This is BTW - one of the few cases where embedding HTML tags in t () strings is not considered bad.
NTN!
source share