def get_alternate_languages(self): """Cache relative urls only. If we have multilingual sites and multi domain site caching absolute urls will result in very inefficient caching. Build absolute url in template. """ tm = ITranslationManager(self.context) catalog = getToolByName(self.context, 'portal_catalog') results = catalog(TranslationGroup=tm.query_canonical(), Language='all') portal_path_len = len( '/'.join(self.portal_state.portal().getPhysicalPath())) alternates = [] for item in results: url = item.getURL(relative=1)[portal_path_len:] alternates.append({ 'lang': item.Language, 'url': url.strip('/'), }) return alternates