I'm a little bit stuck with this: I have a controller where I'm collecting all available languages for an object in pimcore.
Right now I simply take a Localized Field from that object, run through it via foreach
and fill an array with the Localized Fields's keys. So I get all languages for that object. But this is the most ugly piece I've ever coded :)
Update - here is the code:
$o = Object_Product::getById(SOME_ID);
$availableLanguages = array();
// 'category' is an attribute of my product-object that uses Localized Fields
foreach ($o->getCategory()->getLocalizedfields()->getItems() as $language => $value) {
$availableLanguages[] = $language;
}
So I get an array that looks like:
$availableLanguages(
0 => 'en',
1 => 'de',
2 => 'it'
// etc.
);
I'm afraid I've thought too much about it and now I'm missing the forest for the trees - there must be an (more) elegant way for this. Basically Zend_Locale should have this info too, but I don't get it.
Does anyone have a clue for me? Thanks in advance!