Merge pull request #1 from smares/patch-1

Patch for create translation language dropdown
This commit is contained in:
Ingo Schommer 2012-02-14 00:25:07 -08:00
commit ba5d862474

View File

@ -945,6 +945,7 @@ class Translatable extends DataExtension implements PermissionProvider {
// and a translation. Include the current locale (record might not be saved yet). // and a translation. Include the current locale (record might not be saved yet).
$alreadyTranslatedLocales = $this->getTranslatedLocales(); $alreadyTranslatedLocales = $this->getTranslatedLocales();
$alreadyTranslatedLocales[$this->owner->Locale] = $this->owner->Locale; $alreadyTranslatedLocales[$this->owner->Locale] = $this->owner->Locale;
$alreadyTranslatedLocales = array_combine($alreadyTranslatedLocales, $alreadyTranslatedLocales);
if($originalRecord && $isTranslationMode) { if($originalRecord && $isTranslationMode) {
$originalLangID = Session::get($this->owner->ID . '_originalLangID'); $originalLangID = Session::get($this->owner->ID . '_originalLangID');
@ -1009,7 +1010,7 @@ class Translatable extends DataExtension implements PermissionProvider {
new HeaderField('ExistingTransHeader', _t('Translatable.EXISTING', 'Existing translations:'), 3) new HeaderField('ExistingTransHeader', _t('Translatable.EXISTING', 'Existing translations:'), 3)
); );
$existingTransHTML = '<ul>'; $existingTransHTML = '<ul>';
foreach($alreadyTranslatedLocales as $i => $langCode) { foreach($alreadyTranslatedLocales as $langCode) {
$existingTranslation = $this->owner->getTranslation($langCode); $existingTranslation = $this->owner->getTranslation($langCode);
if($existingTranslation) { if($existingTranslation) {
$existingTransHTML .= sprintf('<li><a href="%s">%s</a></li>', $existingTransHTML .= sprintf('<li><a href="%s">%s</a></li>',