Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Where can i change the names of templates?


Reply


7 Posts   1398 Views

Avatar
steffik

Community Member, 15 Posts

6 April 2011 at 2:39am

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?

Avatar
swaiba

Forum Moderator, 1804 Posts

6 April 2011 at 8:21am

It's available as an option within the Page edit form, then Content tab --> Meta data tab --> Title
(save & publish)

Avatar
steffik

Community Member, 15 Posts

7 April 2011 at 9:48pm

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 ;)

Avatar
swaiba

Forum Moderator, 1804 Posts

7 April 2011 at 9:53pm

Are you using the translatable?
When enabled that allows for pages to be translated and all content (including titles) can be locale specific

Avatar
steffik

Community Member, 15 Posts

15 April 2011 at 8:07pm

Thank you - i'll definitely look into that :)

Avatar
t|m

Community Member, 19 Posts

15 April 2011 at 11:25pm

Hi Steffi,

try putting

static $singular_name = "My super Page";

in your pages

Cheers

Avatar
martimiz

Forum Moderator, 1132 Posts

16 April 2011 at 2:55am

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();
   }
}