index.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. =====================================
  2. Internationalization and localization
  3. =====================================
  4. .. toctree::
  5. :hidden:
  6. :maxdepth: 1
  7. translation
  8. formatting
  9. timezones
  10. Overview
  11. ========
  12. The goal of internationalization and localization is to allow a single Web
  13. application to offer its content in languages and formats tailored to the
  14. audience.
  15. Django has full support for :doc:`translation of text
  16. </topics/i18n/translation>`, :doc:`formatting of dates, times and numbers
  17. </topics/i18n/formatting>`, and :doc:`time zones </topics/i18n/timezones>`.
  18. Essentially, Django does two things:
  19. * It allows developers and template authors to specify which parts of their apps
  20. should be translated or formatted for local languages and cultures.
  21. * It uses these hooks to localize Web apps for particular users according to
  22. their preferences.
  23. Obviously, translation depends on the target language, and formatting usually
  24. depends on the target country. This information is provided by browsers in
  25. the ``Accept-Language`` header. However, the time zone isn't readily available.
  26. Definitions
  27. ===========
  28. The words "internationalization" and "localization" often cause confusion;
  29. here's a simplified definition:
  30. .. glossary::
  31. internationalization
  32. Preparing the software for localization. Usually done by developers.
  33. localization
  34. Writing the translations and local formats. Usually done by translators.
  35. More details can be found in the `W3C Web Internationalization FAQ`_, the `Wikipedia article`_ or the `GNU gettext documentation`_.
  36. .. _W3C Web Internationalization FAQ: http://www.w3.org/International/questions/qa-i18n
  37. .. _GNU gettext documentation: http://www.gnu.org/software/gettext/manual/gettext.html#Concepts
  38. .. _Wikipedia article: http://en.wikipedia.org/wiki/Internationalization_and_localization
  39. .. warning::
  40. Translation and formatting are controlled by :setting:`USE_I18N` and
  41. :setting:`USE_L10N` settings respectively. However, both features involve
  42. internationalization and localization. The names of the settings are an
  43. unfortunate result of Django's history.
  44. Here are some other terms that will help us to handle a common language:
  45. .. glossary::
  46. locale name
  47. A locale name, either a language specification of the form ``ll`` or a
  48. combined language and country specification of the form ``ll_CC``.
  49. Examples: ``it``, ``de_AT``, ``es``, ``pt_BR``. The language part is
  50. always in lower case and the country part in upper case. The separator
  51. is an underscore.
  52. language code
  53. Represents the name of a language. Browsers send the names of the
  54. languages they accept in the ``Accept-Language`` HTTP header using this
  55. format. Examples: ``it``, ``de-at``, ``es``, ``pt-br``. Both the language
  56. and the country parts are in lower case. The separator is a dash.
  57. message file
  58. A message file is a plain-text file, representing a single language,
  59. that contains all available :term:`translation strings
  60. <translation string>` and how they should be represented in the given
  61. language. Message files have a ``.po`` file extension.
  62. translation string
  63. A literal that can be translated.
  64. format file
  65. A format file is a Python module that defines the data formats for a given
  66. locale.