Homework #12

Due June 3June 4, at 23:59.

To submit, email your answers to zju.webdev@gmail.com with the subject “Homework #12”.

For this exercise, you will update your contact manager from homework #9/10 (or the REST-enabled one from 11) and add translations to it.

  1. Create a hw12 directory in your repository with a copy of your app. You will be adding functionality to your previous app.

  2. Use your framework's internationalization/localization (i18n/L10n) features so visitors can use your app in either English or Chinese (or any other languages you want, as long as there are two of them).

  3. Make sure there's an appropriate lang attribute for the <html> tag on each page.

  4. Optional: Create a way for the user to change the language they see on your site (in case their browser's Accept-language header doesn't get them what they want).

    [Note: this is optional for the homework, just to make sure it isn't too much work. It should definitely be done for a real site.]

  5. As before, I have created an example completed homework. [Please forgive the quality of the Chinese translations. I had Google Translate, and very little motivation to make them good.]

    Notes:

    • You don't need to do anything except translate the strings. Other aspects of localization can be discovered on your own.
    • Django note: If you are using Simplified Chinese as your other language (and I suspect you are), then you need to refer to the language as "zh-cn" in your settings.py, but do ./manage.py makemessages -l zh_CN (with an underscore) when you create the translation files. StackOverflow question on the topic.
  6. Commit and push your work in the repository to the server.

  7. Send an email to zju.webdev@gmail.com with the subject “Homework #12”. Include the path within your repository where we'll find your work. Be sure to include your student number in the body of the email so we find the right repository.