mgd_set_lang

Posted on 2005-04-22 22:20:45 EEST.

Reading this blog's title you may expect some lang features. Yeah, MgdSchema supports multilang.

Part of MgdSchema.xml file which describes page element.
    <!-- Multilang features -->
    <property name="value" type="text" table="pageelement_i" multilang="yes"/>
    <property name="sid" type="integer" table="pageelement_i"/>
    <property name="lang" type="integer" table="pageelement_i"/>
As you see "multilang" is set only once, and not for every property. The point is that GObject's MgdSchema data collects all "external" tables which should be used for object building functions, and when MgdSchema gets "multilang" xml element's property , sets table's internal pointer to 1 and make it "multilanged". So simply there is no need to point  every property to use multilang. You may of course add another table to object which doesn't use multilang if you really want to use more than two tables for object. Not multilanged tables support is not quite stable yet , as I started to write it on the airport,  waiting for the flight to Helsinki to join MgdSchema workshop team. ( BTW , if I am to describe workshop in only one word , I would like to use word Excellent! )

Multilang is currently usefull for object retrieval and breaks with mysql errors , when create or update method was called. Let's hope to see this fixed next week. Good news about creating objects is that we follow name rules from current midgard version.
When You do create object you can not create object with the same name and with the same parentfield. Except when name of the object is empty. It doesn't affect objects like MidgardParameter or MidgardAttachemnt. Why?
Because we define such behaviour in schema file.
<type name="NewMidgardEventmember" table="eventmember" parent="NewMidgardEvent"
 parentfield="eid">
Set eid property ( or eid field in table ) as parent's one.
<type name="NewMidgardParameter" table="record_extension" parentfield="">
Set parent's to none which means , duplicate names and do not build tree or path for object.
<type name="NewMidgardSnippet" table="snippet" parent="NewMidgardSnippetdir">
Parent is not set at all so by default we set "up" field ( or property ) as parent.

Simple and clear. ( I think so :)

Back

Layout Copyright © 2006 Finnish Teleservice Center Ltd Oy - Site Powered by Midgard CMS