I have developed some custom templates like "Application Page" or "Home Page". Now I'd like to rename their titles so that they show correctly in my language "Anwendungsseite" or "Startseite.
How can this be done?
Where would i have to look?
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
I have developed some custom templates like "Application Page" or "Home Page". Now I'd like to rename their titles so that they show correctly in my language "Anwendungsseite" or "Startseite.
How can this be done?
Where would i have to look?
It's available as an option within the Page edit form, then Content tab --> Meta data tab --> Title
(save & publish)
Thank you :)
But that was not exactly my question. I wanted to change the title that appears on the left column when you create a new page with a given template. I thought there would be some kind of language file where i could define these names but i didn't find it. I know sapphire (or the cms) creates the names from the names of the files so i:
- copied my template files and renamed the copys with the new name
- then i made all existing sites use the new templates
- after that i deleted the old templates and also a few db tables that didn't get correctly deleted
Now at least i have the correct name, but only in English - what i wanted was, have the name in German as well ;)
Are you using the translatable?
When enabled that allows for pages to be translated and all content (including titles) can be locale specific
Thank you - i'll definitely look into that :)
Hi Steffi,
try putting
static $singular_name = "My super Page";
in your pages
Cheers
When creating a new page in the cms, it will appear in the sitetree on the left, named something like 'new MySpecialPagetype' or 'neue MySpecialPagetype'... That had been bothering me for a while.
First, to translate a custom pagetype to a proper name, place this in your languagefile mysite/lang/de_DE.php:
$lang['de_DE']['MySpecialPagetype']['SINGULARNAME'] = 'German name for this pagetype';
This will translate the entries in the Create Page dropdown, but still won't work for the name generated for new pages in the SiteTree. But now you can, in your mysite/code/page.php Page class, something like this:
function onBeforeWrite(){
parent::onBeforeWrite();
if (empty($this->ID)) {
$this->Title = _t('CMSMain.NEW', 'new') . ' ' . $this->i18n_singular_name();
}
}