mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
Merge pull request #1 from smares/patch-1
Patch for create translation language dropdown
This commit is contained in:
commit
ba5d862474
@ -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>',
|
||||||
|
Loading…
Reference in New Issue
Block a user