Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Getting Started

How do I add localization support to my code?

See this wiki page: How to add localization support

Troubleshooting

I'm seeing a KeyError when using my local translations

Localizable strings often include placeholder variable names that must be included precisely in each translation. If by mistake a placeholder name is misspelled, then you will see an error something like this:

Traceback (most recent call last):
 File "/edx/app/edxapp/edx-platform/common/djangoapps/util/views.py", line 87, in inner
   return func(request, *args, **kwargs)
 File "/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/views/webview.py", line 574, in render_html_view
   _update_certificate_context(context, user_certificate, platform_name)
 File "/edx/app/edxapp/edx-platform/lms/djangoapps/certificates/views/webview.py", line 111, in _update_certificate_context
   course_number=context['course_number']
KeyError: u'username'

In this example, the code was expecting to provide a variable called ``user_name`` but the translation accidentally switched it to ``username``. Unfortunately the error message does not make clear what the problem is, but the solution is to correct the translation that has the incorrect placeholder.

See the following for more details:


  • No labels