Skip to content

Commit

Permalink
Extended ulocalized_time for target_language
Browse files Browse the repository at this point in the history
  • Loading branch information
agitator committed Jan 21, 2015
1 parent 7f99f88 commit 58b4e25
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Products/CMFPlone/i18nl10n.py
Expand Up @@ -103,7 +103,7 @@ def get_formatstring_from_registry(msgid):


def ulocalized_time(time, long_format=None, time_only=False, context=None,
domain='plonelocales', request=None):
domain='plonelocales', request=None, target_language=None):
"""unicode aware localized time method (l10n)"""

if time_only:
Expand Down Expand Up @@ -167,7 +167,8 @@ def ulocalized_time(time, long_format=None, time_only=False, context=None,

# 2. the normal case: translation machinery,
# that is the ".../LC_MESSAGES/plonelocales.po" files
formatstring = translate(msgid, domain, mapping, request)
formatstring = translate(msgid, domain, mapping, request,
target_language=target_language)

# 3. if both failed, fall back to hardcoded ISO style
if formatstring == msgid:
Expand Down Expand Up @@ -219,10 +220,12 @@ def ulocalized_time(time, long_format=None, time_only=False, context=None,
# translate translateable elements
for key in name_elements:
mapping[key] = translate(mapping[key], domain,
context=request, default=mapping[key])
context=request, default=mapping[key],
target_language=target_language)

# translate the time string
return translate(msgid, domain, mapping, request)
return translate(msgid, domain, mapping, request,
target_language=target_language)


def _numbertoenglishname(number, format=None, attr='_days'):
Expand Down
3 changes: 3 additions & 0 deletions docs/CHANGES.rst
Expand Up @@ -8,6 +8,9 @@ Changelog
4.3.5 (unreleased)
------------------

- Extended ulocalized_time for target_language
[agitator]

- Allow search_rss view on subsites (implementing INavigationRoot, not only
IPloneSiteRoot) like it was the case in Plone 4.1.6.
[vincentfretin]
Expand Down

1 comment on commit 58b4e25

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TESTS FAILED
Mr.roboto url : http://jenkins.plone.org/roboto/get_info?push=d0ac8b6d1537421e9de3957c0bef2889
plone-4.3-python-2.6 [FAILURE]
plone-4.3-python-2.7 [SUCCESS]

Please sign in to comment.