[ckan-changes] [okfn/ckan] 1c5614: [xs] docstring typo fix

GitHub noreply at github.com
Mon Apr 30 14:59:20 UTC 2012


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: 1c56149bab168f730b80e88699463573a0d153a0
      https://github.com/okfn/ckan/commit/1c56149bab168f730b80e88699463573a0d153a0
  Author: Toby <toby.junk at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckan/lib/helpers.py

  Log Message:
  -----------
  [xs] docstring typo fix


diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py
index 408b912..1e83699 100644
--- a/ckan/lib/helpers.py
+++ b/ckan/lib/helpers.py
@@ -153,7 +153,7 @@ def _add_i18n_to_url(url_to_amend, **kw):
     return url
 
 def lang():
-    ''' Reurn the language code for the current locale eg `en` '''
+    ''' Return the language code for the current locale eg `en` '''
     return request.environ.get('CKAN_LANG')
 
 class Message(object):


================================================================
  Commit: 1cdada36cbc99b2594688c00243df49de2d2ff44
      https://github.com/okfn/ckan/commit/1cdada36cbc99b2594688c00243df49de2d2ff44
  Author: Toby <toby.junk at gmail.com>
  Date:   2012-04-30 (Mon, 30 Apr 2012)

  Changed paths:
    M ckan/lib/helpers.py

  Log Message:
  -----------
  [xs] add new lang_native_name() template helper


diff --git a/ckan/lib/helpers.py b/ckan/lib/helpers.py
index 1e83699..ed0ed72 100644
--- a/ckan/lib/helpers.py
+++ b/ckan/lib/helpers.py
@@ -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()``.
 
@@ -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',


================================================================
Compare: https://github.com/okfn/ckan/compare/45c30b6...1cdada3


More information about the ckan-changes mailing list