In a cck field "text"->"select" I added some arrays to the "allowed php code" under the "allowed values". To the content type "userprofile"

$array = array(
    "af" => t("Afghanistan"),
    "al" => t("Albania"),
    "dz" => t("Algeria"),
    "ad" => t("Andorra"),
...
    "ye" => t("Yemen"),
    "zm" => t("Zambia"),
    "zw" => t("Zimbabwe")
);
return $array;

If I put sort $array; above the return then there occurs a problem to the output. E.g. I choose "Albania" in my userprofile then the same is shown in the output. But if I switch to another language then the output is different... e.g. "germany" or something like this.

The goal is to sort the labels in every language I chose form the language switcher.

Anybody could give me a tip to solve my problem?

Comments

buchannon’s picture

I've had a lot of problems with CCk and values/default values before, but it sounds like that part is working fine for you. So you want to be able to sort the languages dynamically depending on which language you are viewing in?

My first guess would be something like this:

$languages = array(
    "af" => t("Afghanistan"),
    "al" => t("Albania"),
    "dz" => t("Algeria"),
    "ad" => t("Andorra"),
...
    "ye" => t("Yemen"),
    "zm" => t("Zambia"),
    "zw" => t("Zimbabwe")
);
asort($languages);
return $languages;
ckidow’s picture

Thanks a lot... that works fine! :)

MfG

CKIDOW