Try this: final STKPageModel pageModel = new STKPageModel(content, null, parentModel, stkFunctions, templatingFunctions); final Site site = pageModel.getSite(); final I18nContentSupport i18n = site.getI18n();
i18n.getLocales() You need to configure the i18n node in the STK Site Configuration: Here you get an example XML for this. Copy it in an xml file and import it into site configuration. <?xml version="1.0" encoding="UTF-8"?> <sv:node sv:name="i18n" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:contentNode</sv:value> </sv:property> <sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true"> <sv:value>mix:lockable</sv:value> </sv:property> <sv:property sv:name="jcr:uuid" sv:type="String"> <sv:value>e5aed01c-e28f-4f54-8992-c1c80bcc0a9a</sv:value> </sv:property> <sv:property sv:name="class" sv:type="String"> <sv:value>info.magnolia.cms.i18n.DefaultI18nContentSupport</sv:value> </sv:property> <sv:property sv:name="defaultLocale" sv:type="String"> <sv:value>de</sv:value> </sv:property> <sv:property sv:name="enabled" sv:type="String"> <sv:value>true</sv:value> </sv:property> <sv:property sv:name="fallbackLocale" sv:type="String"> <sv:value>de</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:node sv:name="MetaData"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:metaData</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:property sv:name="mgnl:authorid" sv:type="String"> <sv:value>superuser</sv:value> </sv:property> <sv:property sv:name="mgnl:creationdate" sv:type="Date"> <sv:value>2012-06-13T17:12:43.762+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> <sv:value>2012-06-13T17:14:48.025+02:00</sv:value> </sv:property> </sv:node> <sv:node sv:name="locales"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:contentNode</sv:value> </sv:property> <sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true"> <sv:value>mix:lockable</sv:value> </sv:property> <sv:property sv:name="jcr:uuid" sv:type="String"> <sv:value>e0251109-df0d-49c8-b71a-e4e6b8b3a715</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:node sv:name="MetaData"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:metaData</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:property sv:name="mgnl:authorid" sv:type="String"> <sv:value>superuser</sv:value> </sv:property> <sv:property sv:name="mgnl:creationdate" sv:type="Date"> <sv:value>2012-06-13T17:12:51.197+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> <sv:value>2012-06-13T17:12:55.483+02:00</sv:value> </sv:property> </sv:node> <sv:node sv:name="it"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:contentNode</sv:value> </sv:property> <sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true"> <sv:value>mix:lockable</sv:value> </sv:property> <sv:property sv:name="jcr:uuid" sv:type="String"> <sv:value>ea312d84-8b08-496e-afde-c156333ba93c</sv:value> </sv:property> <sv:property sv:name="country" sv:type="String"> <sv:value/> </sv:property> <sv:property sv:name="enabled" sv:type="String"> <sv:value>true</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:property sv:name="language" sv:type="String"> <sv:value>it</sv:value> </sv:property> <sv:property sv:name="variant" sv:type="String"> <sv:value>asasd</sv:value> </sv:property> <sv:node sv:name="MetaData"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:metaData</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:property sv:name="mgnl:authorid" sv:type="String"> <sv:value>superuser</sv:value> </sv:property> <sv:property sv:name="mgnl:creationdate" sv:type="Date"> <sv:value>2012-06-13T17:12:59.271+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> <sv:value>2012-07-20T09:28:02.317+02:00</sv:value> </sv:property> </sv:node> </sv:node> <sv:node sv:name="fr"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:contentNode</sv:value> </sv:property> <sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true"> <sv:value>mix:lockable</sv:value> </sv:property> <sv:property sv:name="jcr:uuid" sv:type="String"> <sv:value>30dfe758-b474-433d-890d-c4709fc0b3d6</sv:value> </sv:property> <sv:property sv:name="country" sv:type="String"> <sv:value/> </sv:property> <sv:property sv:name="enabled" sv:type="String"> <sv:value>true</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:property sv:name="language" sv:type="String"> <sv:value>fr</sv:value> </sv:property> <sv:node sv:name="MetaData"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:metaData</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:property sv:name="mgnl:activated" sv:type="Boolean"> <sv:value>false</sv:value> </sv:property> <sv:property sv:name="mgnl:authorid" sv:type="String"> <sv:value>superuser</sv:value> </sv:property> <sv:property sv:name="mgnl:creationdate" sv:type="Date"> <sv:value>2012-06-13T17:12:59.271+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> <sv:value>2012-06-13T17:13:49.222+02:00</sv:value> </sv:property> </sv:node> </sv:node> <sv:node sv:name="de"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:contentNode</sv:value> </sv:property> <sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true"> <sv:value>mix:lockable</sv:value> </sv:property> <sv:property sv:name="jcr:uuid" sv:type="String"> <sv:value>dfeb3680-4918-488d-b9b2-2c57494793b2</sv:value> </sv:property> <sv:property sv:name="country" sv:type="String"> <sv:value/> </sv:property> <sv:property sv:name="enabled" sv:type="String"> <sv:value>true</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:property sv:name="language" sv:type="String"> <sv:value>de</sv:value> </sv:property> <sv:node sv:name="MetaData"> <sv:property sv:name="jcr:primaryType" sv:type="Name"> <sv:value>mgnl:metaData</sv:value> </sv:property> <sv:property sv:name="jcr:createdBy" sv:type="String"> <sv:value>admin</sv:value> </sv:property> <sv:property sv:name="mgnl:activated" sv:type="Boolean"> <sv:value>false</sv:value> </sv:property> <sv:property sv:name="mgnl:authorid" sv:type="String"> <sv:value>superuser</sv:value> </sv:property> <sv:property sv:name="mgnl:creationdate" sv:type="Date"> <sv:value>2012-06-13T17:12:59.271+02:00</sv:value> </sv:property> <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> <sv:value>2012-06-13T17:13:52.955+02:00</sv:value> </sv:property> </sv:node> </sv:node> </sv:node> </sv:node> ________________________________________ Von: [email protected] [[email protected]] im Auftrag von Petr Kadlec (via Magnolia Forums) [[email protected]] Gesendet: Freitag, 27. Juli 2012 23:10 An: Magnolia User List Betreff: [magnolia-user] Re: Language links to actual page (i18n) Thanks a lot Richard for your thorough and very helpful answer! You made my day, because trying to set up magnolia dev environment for the first time, uff, not easy :) I will definetely try all your suggestions and I will stick just with creating modules if it's possible. Now I'm trying to adjust your code for language switching links in 4.5, but I got stuck on getting available locales. I will let you know when i get it working! Thanks again! Petr -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=c63ffdf2-b53b-4a0d-a393-7bdcc7549c5d ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ---------------------------------------------------------------- ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
