Skip to content

Commit

Permalink
[xs] add new lang_native_name() template helper
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Apr 30, 2012
1 parent 1c56149 commit 1cdada3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckan/lib/helpers.py
Expand Up @@ -156,6 +156,11 @@ def lang():
''' Return the language code for the current locale eg `en` '''
return request.environ.get('CKAN_LANG')

def lang_native_name():
''' Return the langage name currently used in it's localised form '''
locale = get_locales_dict().get(lang())
return locale.display_name or locale.english_name

class Message(object):
"""A message returned by ``Flash.pop_messages()``.
Expand Down Expand Up @@ -799,6 +804,7 @@ def process_names(items):
'snippet',
'convert_to_dict',
'activity_div',
'lang_native_name',
# imported into ckan.lib.helpers
'literal',
'link_to',
Expand Down

0 comments on commit 1cdada3

Please sign in to comment.