Skip to content

Commit

Permalink
Corrige o tile de Agenda quando a lingua é diferente de pt-br (#150)
Browse files Browse the repository at this point in the history
* Corrige o tile de Agenda quando a lingua é diferente de pt-br

* Code review
  • Loading branch information
rodfersou authored and hvelarde committed Oct 19, 2018
1 parent dbec6b9 commit a89b15f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
2.0a8 (unreleased)
^^^^^^^^^^^^^^^^^^

- Nothing changed yet.
- Corrige o tile de Agenda quando a lingua é diferente de Português Brasileiro (fecha `#149 <https://github.com/plonegovbr/brasil.gov.agenda/issues/149>`_).
[rodfersou]


2.0a7 (2018-09-28)
Expand Down
5 changes: 2 additions & 3 deletions src/brasil/gov/agenda/browser/mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ def _translate(self, msgid, locale='plonelocales', mapping=None):
tool = api.portal.get_tool('translation_service')
portal_state = getMultiAdapter((self.context, self.request),
name=u'plone_portal_state')
current_language = portal_state.language()
language = portal_state.language()
# XXX: Por que é retornado 'pt-br' do portal_state ao invés de 'pt_BR'?
# Quando uso 'pt-br' ao invés de 'pt_BR', não pega a tradução quando
# feita de forma manual.
target_language = ('pt_BR' if current_language == 'pt-br'
else self.current_language)
target_language = 'pt_BR' if language == 'pt-br' else language
return tool.translate(msgid,
locale,
mapping=mapping,
Expand Down

0 comments on commit a89b15f

Please sign in to comment.