Skip to content

Commit

Permalink
Refs #87470 Added language entry to the latest version link in order …
Browse files Browse the repository at this point in the history
…for it to work properly.
  • Loading branch information
Petchesi-Iulian committed Sep 19, 2017
1 parent 4213a72 commit 46bb6c9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Changelog

10.3.dev0 - (unreleased)
------------------------
* Bug fix: Added language entry to the latest version link in order for it to
work properly
[petchesi-iulian refs #87470]

10.2 - (2017-09-15)
-------------------
Expand Down
7 changes: 4 additions & 3 deletions eea/versions/skins/versions_templates/versions_macros.pt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

<dt i18n:translate="">Permalink to latest version</dt>
<dd>
<a tal:define="start string:${context/portal_url}/ds_resolveuid/;
version python:versionId or uid; "
tal:attributes="href string:${start}${version}; title version"
<a tal:define="start string:${context/portal_url};
version python: versionId or uid;
language versions_view/getCurrentLanguage; "
tal:attributes="href string:${start}/${language}/ds_resolveuid/${version}; title version"
tal:content="version" />
</dd>

Expand Down
11 changes: 11 additions & 0 deletions eea/versions/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,17 @@ def getLatestVersionUrl(self):

return self.latest_version().absolute_url()

def getCurrentLanguage(self):
""" Return the language of the context
"""
context = self.context
portal_state = context.unrestrictedTraverse("@@plone_portal_state")
lang = aq_inner(context).Language() or portal_state.default_language()

if lang == 'en':
return 'SITE'
return lang


class GetVersionsView(BrowserView, GetVersions):
""" The @@getVersions view
Expand Down

0 comments on commit 46bb6c9

Please sign in to comment.