mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
ENHANCEMENT Don't show translations dropdown if all translations have been created.
This commit is contained in:
parent
44f8180110
commit
27208655b9
@ -989,11 +989,23 @@ class Translatable extends DataExtension implements PermissionProvider {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$createButton->includeDefaultJS(false);
|
$createButton->includeDefaultJS(false);
|
||||||
|
|
||||||
|
if ( count($langDropdown->getSource()) < 1 ) {
|
||||||
|
$fields->insertAfter(
|
||||||
|
new LiteralField(
|
||||||
|
'AllTransCreated',
|
||||||
|
_t('Translatable.ALLCREATED', 'All allowed translations have been created.')
|
||||||
|
),
|
||||||
|
'CreateTransHeader'
|
||||||
|
);
|
||||||
|
$fields->removeByName('NewTransLang');
|
||||||
|
$fields->removeByName('createtranslation');
|
||||||
|
}
|
||||||
|
|
||||||
if($alreadyTranslatedLocales) {
|
if($alreadyTranslatedLocales) {
|
||||||
$fields->addFieldToTab(
|
$fields->addFieldToTab(
|
||||||
'Root.Translations',
|
'Root.Translations',
|
||||||
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 $langCode) {
|
foreach($alreadyTranslatedLocales as $langCode) {
|
||||||
|
@ -7,9 +7,10 @@ en:
|
|||||||
LANGAOTHER: 'Other languages'
|
LANGAOTHER: 'Other languages'
|
||||||
LANGAVAIL: 'Available languages'
|
LANGAVAIL: 'Available languages'
|
||||||
Translatable:
|
Translatable:
|
||||||
|
ALLCREATED: 'All allowed translations have been created.'
|
||||||
CREATE: 'Create new translation'
|
CREATE: 'Create new translation'
|
||||||
CREATEBUTTON: Create
|
CREATEBUTTON: Create
|
||||||
EXISTING: 'Existing translations:'
|
EXISTING: 'Existing translations'
|
||||||
NEWLANGUAGE: 'New language'
|
NEWLANGUAGE: 'New language'
|
||||||
NOTICENEWPAGE: 'Please save this page before creating a translation'
|
NOTICENEWPAGE: 'Please save this page before creating a translation'
|
||||||
TRANSLATEALLPERMISSION: 'Translate into all available languages'
|
TRANSLATEALLPERMISSION: 'Translate into all available languages'
|
||||||
|
Loading…
Reference in New Issue
Block a user