Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Oct 19, 2018
1 parent f2077f8 commit 1a7939b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog
2.0a8 (unreleased)
^^^^^^^^^^^^^^^^^^

- Corrige o tile de Agenda quando a lingua é diferente de pt-br (fixes `#149 <https://github.com/plonegovbr/brasil.gov.agenda/issues/149>`_).
- 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]


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 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 1a7939b

Please sign in to comment.