5522 Posts in 1734 Topics by 1224 members
|Go to End|
12 July 2011 at 9:01pm
I have a question regarding selecting page type name during a page creation.
Let's say that a site is configured for using multi language logic and we need to create a structure in English and German language. When a user from England creates a page there is an option for selecting page type and the type name is created based on the class name, e.g. HomePage will be listed as "Home", ArticlePage will be listed as "Article" etc.
A scenario that I am trying to create is to change displayed page type based on selected language. So, if a user from Germany wants to create an article page in German, he/she should be able to select "Artikel" page type instead of "Article", "Start" instead "Home" page type...
Of course, this should be done without duplicating classes with the same functionality and changing their names only.
I checked documentation but didn't find any property that could be used for this logic. I am not even sure whether is this possible but I would appreciate if someone has a suggestion(s).
12 July 2011 at 10:14pm
Maybe you could use something like this in your PageTypes:
static $singular_name = _t('YourPageType.SINGULARNAME', 'Page Type');
static $plural_name = _t('YourPageType.PLURALNAME', 'Page Types');
and create the lang files accordingly in your /mysite/lang directory, e.g. like this:
$lang['en_US']['YourPageType']['SINGULARNAME'] = 'Page Type';
$lang['de_DE']['YourPageType']['SINGULARNAME'] = 'Seitentyp';//oder so
Note, this is just an idea.
I can't test it, since I'm not on my machine right now and there might be a lot of typos or I might be totally wrong with my idea
12 July 2011 at 10:54pm Last edited: 12 July 2011 10:59pm
Thank you, Invader.
I think it will do the job. In the meantime I have found the similar sample in the book "SilverStripe: the complete guide to CMS development" and in the topic http://silverstripe.org/general-questions/show/8689 . I will try later and let you know if it's fixed. And.. MitraX (with 't') ;)
12 July 2011 at 11:35pm
And.. MitraX (with 't') ;)
Uhhh, sorry for that...shame on me
Good luck MitraX
|Go to Top|