Is it possible to translates strings stored in variables?

Concider the following example code:

<?php
$sizes
= array("Big", "Medium", "Small");
foreach (
$sizes as $size) {
  print
t("$size");
}
?>

If the array is small, or well defined, one could easily get around this with something like
<?php
switch ($size) {
  case
"Big":
  print
t("Big");
(...)
?>

but with big arrays or many options, this would could get really ugly.

Rgds.

Comments

The extractor script is unable to find these out, so if you generate a pot file out of your module, it will not contain those generated dynamically. This is why core and most of contrib modules keep away from doing this. It is advised against, however will work quite fine.